powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Зачем надстраиваемый класс над TableAdapter?
2 сообщений из 2, страница 1 из 1
Зачем надстраиваемый класс над TableAdapter?
    #33968515
Snorry
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Доброго времени суток!

При рассмотрения примера с сайта ASP.NET — http://www.asp.net/learn/dataaccess/tutorial01cs.aspx?tabid=63
наткнулся на следующий абзац

While auto-generated code can be a great time saver, the code is often very generic and needs to be customized to meet the unique needs of an application. The risk of extending auto-generated code, though, is that the tool that generated the code might decide it's time to "regenerate" and overwrite your customizations. With .NET 2.0's new partial class concept, it's easy to split a class across multiple files. This enables us to add our own methods, properties, and events to the auto-generated classes without having to worry about Visual Studio overwriting our customizations.

To demonstrate how to customize the DAL, let's add a GetProducts() method to the SuppliersRow class. The SuppliersRow class represents a single record in the Suppliers table; each supplier can provider zero to many products, so GetProducts() will return those products of the specified supplier. To accomplish this create a new class file in the App_Code folder named SuppliersRow.cs and add the following code:

Подскажите пожалуйста, зачем еще надстраивать класс?
...
Рейтинг: 0 / 0
Зачем надстраиваемый класс над TableAdapter?
    #33972934
Snorry
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здравствуйте, Snorry, Вы писали:

S>Доброго времени суток!

S>При рассмотрения примера с сайта ASP.NET — http://www.asp.net/learn/dataaccess/tutorial01cs.aspx?tabid=63
S>наткнулся на следующий абзац

S>While auto-generated code can be a great time saver, the code is often very generic and needs to be customized to meet the unique needs of an application. The risk of extending auto-generated code, though, is that the tool that generated the code might decide it's time to "regenerate" and overwrite your customizations. With .NET 2.0's new partial class concept, it's easy to split a class across multiple files. This enables us to add our own methods, properties, and events to the auto-generated classes without having to worry about Visual Studio overwriting our customizations.

S>To demonstrate how to customize the DAL, let's add a GetProducts() method to the SuppliersRow class. The SuppliersRow class represents a single record in the Suppliers table; each supplier can provider zero to many products, so GetProducts() will return those products of the specified supplier. To accomplish this create a new class file in the App_Code folder named SuppliersRow.cs and add the following code:

S>Подскажите пожалуйста, зачем еще надстраивать класс?

Спасибо, уже сам разобрался.
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Зачем надстраиваемый класс над TableAdapter?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]