Вопрос

Have added designer extensions to EDMX designer which allow me to specify additional information I am using with some T4 templates. All working well but I want to assign defaults to some of my properties when the model is first created or udpated. For example, I want to set one of my property values to a certain value for primary keys. Any idea how I can hook into this?

Thanks

Ray

Это было полезно?

Решение

Hooking into creation means specifying the default value simply for property backing field or setting it in constructor. Hooking into updating requires logic in property setters - that is usually handled by implementing INotifyPropertyChanged interface.

Другие советы

I used SQL Server to delete the DocumentNode (hierachyid) and DocumentLevel columns in the Production.Document table, then set the Title column as the primary key of the table. This seems to have worked... so far.

In SQL Server Object Explorer > Expand the AdventureWorks db to the Production.Document table > Expand Columns folder > RightClick DocumentNode > Click Modify >>> table populates in the query editor > Right click Columns you wish to edit.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top