문제

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