ASP.NET 2.0服务器控件与组件开发高级编程

译文:图1-1中的柱形表示了从一个HttpContext对象到另一个HttpContext对象的过程。
原文:The cylinders in Figure 1-1 represent the HttpContext object as it’s passed from one component to another.
建议:图1-1中的那些圆柱体代表在组件间传送的HttpContext对象。
评论:只有一个HttpContext对象,只是在不同的组件间传递而已。

译文:不要考虑那些不支持Cookie或者禁用Cookie的客户端。
原文:This leaves out those clients that don’t support cookies or where cookies are disabled.
建议:这并没有考虑那些不支持Cookie或者禁用Cookie的客户端。

译文:如果使用ASP.NET 2.0框架开发一个新的Web应用程序,同时对于客户端也没有任何有关位置、格式或者架构的需求,在这种情况下要求存储应用程序的角色信息,那么可以将角色信息存储在一个名为aspnetdb的标准SQL Server数据库中。
原文:If you’re using the ASP.NET 2.0 Framework to develop a brand new Web application, and if your clients don’t have any requirements as to where and in what format or schema you should store your application’s role information, you can store the role information in the standard SQL Server database named aspnetdb.
建议:如果使用ASP.NET 2.0框架开发一个全新的Web应用程序,而你的客户对于应用程序中角色信息的存储位置、格式或者模式也没有什么特别要求的话,那么可以将角色信息存储在一个名为aspnetdb的标准SQL Server数据库中。
评论:这里的Client是指一般意义上的客户(人),并非指客户端(电脑)。

译文:然而,如果必须将现有的应用程序移动到新框架中,则不能实现对包含旧有角色信息的数据库转储,而开始使用aspnetdb数据库。
原文:However, if you have to move your existing applications to the new Framework, you can’t afford to dump the database where your application has been storing role information for the last few years and start using the aspnetdb database.
建议:然而,如果要将将现有的应用程序迁移到新框架中,你不可能扔掉原有的用于保存角色信息的数据库而直接使用aspnetdb数据库。
评论:dump是丢弃而不是转储的意思。

译文:第20章、第23章和第24章讲解开发角色提供程序所需要的内容,角色提供程序可使用ASP.NET框架的角色管理功能来集成所希望的数据存储(包括关系型数据库,如SQL Server和Oracle,以及非关系型数据存储,如XML文档)。
原文:Chapters 20, 23, and 24 teach you everything you need to develop a role provider that will allow you to integrate your desired role data store (both relational such as SQL Server and Oracle, and non-relational such as XML documents) with the role management features of the ASP.NET 2.0 Framework.
建议:第20章、第23章和第24章讲解开发角色提供程序所需要的内容,让你可以将所希望的数据存储(包括关系型数据库,如SQL Server和Oracle,以及非关系型数据存储,如XML文档)集成到ASP.NET框架的角色管理功能中。

译文:类似于角色提供程序,如果应用程序需要从ASP.NET 1.x迁移到2.0,那么不能实现对包含旧有用户成员资格信息的数据库转储,而需要使用新的aspnetdb数据库。
原文:Much like the role provider, if you have applications that you need to move from ASP.NET 1.x to 2.0, you can’t afford to dump the databases where you have been storing you user membership information for the last few years and jump to the new aspnetdb database.
建议:类似于角色提供程序,如果应用程序需要从ASP.NET 1.x迁移到2.0,那么你不可能扔掉原有的保存用户成员资格信息的数据库而直接使用新的aspnetdb数据库。

译文:常见的问题之一是会显著地降低性能和包含大量数据的XML Web服务响应。
原文:One of these common problems is the significant degradation of the performance and responsiveness of XMLWeb services that expose huge amounts of data.
建议:常见的问题之一是对于提供大量数据的XML Web服务来说,其性能及响应速度会显著降低。

译文:在本章读者将学习如何将包含打开和关闭标记的表单元素的嵌套HTML标记文本,转换为名为CreditCardForm1的服务器控件,开发人员使得该控件隐藏了HTML标记文本。
原文:In this chapter you learn how to transform the nested HTML markup text within the form element’s opening and closing tags into a server control named CreditCardForm1 that hides this HTML markup text from page developers.
建议:在本章读者将学习如何将位于form元素的开始和结束标记之间的HTML标记文本转移到一个名为CreditCardForm1的服务器控件中,从而对页面开发人员隐藏该HTML标记文本。

译文:必须将自定义控件编译为程序集,并将程序集部署到服务器端,这样才能够在Web应用程序中使用自定义控件。如何实现部署程序集依赖于如何编译自定义控件。当开始部署自定义控件时有两个选项。
原文:You have to compile your custom control to an assembly and deploy the assembly to the client side to allow clients to use your custom control in their Web applications. How you plan on deploying the assembly determines how you have to compile your custom control. You have two options when it comes to deploying a custom control.
建议:你必须将自定义控件编译为程序集,并将程序集部署到客户的电脑上,这样客户(页面开发人员)才能够用你的自定义控件来开发Web应用。你部署程序集的方式决定了你应该如何编译自定义控件。部署自定义控件的方式有两种。
评论:由于讨论的是服务器控件,所以其Client是指page developer,因此这里的client side应该是指page developer的电脑。另外,是编译方式依赖于部署方式。

译文:属性(Property)层次属性(Attribute)
原文:Property-Level Attributes
评论:要么就不要翻译,保留英文术语;要么就把Attribute翻译成“特性”,否则让人看得眼花。

译文:另外,设计器将使用自定义前缀替代ccl:
原文:With this addition, the designer will use the custom prefix instead of ccl:
建议:在添加了这个Attribute以后,设计器将使用自定义前缀而不是ccl:
评论:With this addition != in addition

译文:由于需要键入枚举值,因此使用编译器的拼写检查功能可避免与字符串操作相关的问题。
原文:Because the values of these enumerations are typed, you can benefit from the compiler typechecking capability to avoid problems associated with string manipulations.
建议:由于枚举值是强类型的,因此可借助编译器的类型检查功能来避免使用字符串引致的问题。
评论:这里的type作“类型”解,而非“打字”的意思。

译文:一个版本使用HTML 4.0标准编译,另一个版本使用HTML 3.2标准编译。
原文:One version complies with the HTML 4.0 standard, and the other version complies with the HTML 3.2 standard.
建议:一个版本符合HTML 4.0标准,另一个版本符合HTML 3.2标准。
评论:complies != compiles

译文:是否将Render方法不声明为virtual是问题真正的关键所在。
原文:That would indeed be the case if the Render method weren’t declared as virtual.
建议:如果没有将Render方法声明为virtual,那么你确实需要这样做。
评论:这里的if是“如果”而不是“是否”的意思。这个case是指前文所谈及的“you have to also rewrite all the properties and property- and class-level attributes that you wrote for CreditCardForm2.”。

译文:您应该总是将自定义控件中的方法声明为virtual,那么其他需要重写的人则能够提供他们自己的实现。
原文:You should always declare as virtual those methods of your custom control that you anticipate others may want to override to provide their own implementations.
建议:对于自定义控件中的方法,如果你认为其他开发人员有可能希望重写以便提供他们自己的实现的话,您应该将其声明为virtual。
评论:译文“总是将自定义控件中的方法声明为virtual”未免太绝对了。

译文:这是ASP.NET应用程序隐藏的扩展能力。如果应用程序通过页面请求保持状态,那么它将不可能支持数以千计的访问者。也就是说,如果自定义控件的属性需要通过页面回传保持值,那么必须采取额外的步骤。
原文:This is the secret of the scalability of ASP.NET Web applications. If these applications were to maintain state across page requests, it would be impossible for them to support thousands of visitors a day.That said, if the properties of your custom control need to maintain their values across page postbacks, you have to take extra steps.
建议:这就是ASP.NET应用程序具有可扩展性的秘密。如果应用程序要在不同的页面请求之间保持状态,那么它将不可能支持数以千计的访问者。然而,如果你的自定义控件的属性需要在页面回传后保持其值的话,就必须采取额外的步骤。
评论:“That said”有转折的味道,不应该译为“也就是说”。
 
译文:只要标记前缀属性(TagPrefix)和标记名属性(TagName)组成页面中唯一的对,就可以将这两个属性设置为任何有效的字符串值。
原文:You can set the values of the tag prefix and tag name attributes to any valid string values as long as these two values together form a unique pair on the page.
建议:你可以用任何有效的字符串设置标记前缀(TagPrefix)和标记名(TagName)这两个属性的值,只要两者组合起来在页面中是唯一就可以了。

译文:如果设置了ClassName属性,那么页面开发人员则可能通过计算方法返回值来获得用户控件的实际类型,从而通过编程方式访问器属性和方法。
原文:If you set the ClassName attribute, you’ll make it possible for page developers to type cast the return value of this method to the actual type of the user control so they can access its properties and methods in programmatic fashion.

建议:如果设置了ClassName属性,那么页面开发人员则可以把该方法的返回值转换为用户控件的实际类型,从而通过编程方式访问其属性和方法。
评论:“cast”在这里是类型转换的意思,而不是“计算”。

译文:也就是说,在ASP.NET Web部件框架中,用户控件扮演了重要的角色。
原文:That said,user controls play an important role in ASP.NET Web Parts Framework.
建议:然而,在ASP.NET Web部件框架中,用户控件扮演了重要的角色。
评论:“That said”有转折的味道,不应该译为“也就是说”。

译文:当编译代码时,您可使用编译器拼写检查功能来捕获错误。
原文:You can take advantage of the type-checking capability of compilers to catch the errors as you’re compiling the code.
建议:当编译代码时,您可使用编译器的类型检查功能来捕获错误。

译文:注意,RenderContens方法不会呈现自身的HTML标记文本,也不会简单调用Control基类的Render方法。
原文:Notice that RenderContents doesn’t render HTML markup text on its own, and simply calls the Render method of its base class, that is, the Control class.
建议:注意,RenderContens方法自身并没有呈现HTML标记文本,而只是简单调用其基类(Control类)的Render方法。

译文:CreditCardForm5控件必须为每个TableStyle类的属性公开属性,其中的get访问器和set访问器必须分别将TableStyle类的属性委托给控件属性。
原文:CreditCardForm5 must expose one property for each new property of the TableStyle class, where the getter and setter of the property must delegate to 建议:the respective property of the TableStyle class as shown in the following code:
建议:对于TableStyle类的每一个新属性,CreditCardForm5控件必须为其公开一个属性,该属性中的getter和setter把任务委托给相应的TableStyle类的属性。如下所示:
评论:委托的方向搞反了。

译文:换言之,其采用了同样的方法,即WebControl类的get访问器和set访问器分别将Style类的属性委托给自身属性。
原文:In other words, following the same approach as yours, WebControl exposes properties whose getters and setters delegate to the respective properties of the Style class.
评论:委托的方向还是搞反了。

译文:这两段代码的另一个不同是,CreditCardForm5没有对某些内容进行进行硬编码,这些内容包括3个HTML元素select的HTML属性name和id。同时,两个HTML元素input的HTML属性type设置为字符串值text。
原文:Another difference between these two listings is that CreditCardForm5 doesn’t hard-code the values of the name and id HTML attributes of the three select HTML elements and two input HTML elements whose type HTML attributes are set to the string value “text”.
建议:这两段代码的另一个不同是,CreditCardForm5没有对三个select元素和两个input元素(这两个元素的type属性设置为字符串值“text”)的name和id属性值进行硬编码。

译文:CreditCardForm5控件隐藏了HTML元素table的部分内容及其样式属性,并且页面开发人员能够方便地设置样式属性。
原文:The CreditCardForm5 control hides the underlying table HTML element and its style attributes from page developers and provides them with a convenient set of properties to set these style attributes.
建议:

 

posted on 2007-08-30 22:54  融化了的朱古力  阅读(566)  评论(2编辑  收藏  举报

导航