How to set IsUnique within Entity Developer

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Zero-G.
Posts: 391
Joined: Sat 09 Dec 2006 12:20

How to set IsUnique within Entity Developer

Post by Zero-G. » Mon 23 Nov 2015 15:37

Hey

I have to place an Index atribute before the property.
How can I do this within Entity Developer?
I Need:

Code: Select all

<Index("IX_FirstAndSecond", 1, IsUnique:=True)> _
Public Property Supplier as Guid
THX

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: How to set IsUnique within Entity Developer

Post by Shalex » Tue 24 Nov 2015 11:40

You can add an attribute via interface of Entity Developer in the way described at http://www.devart.com/entitydeveloper/e ... eloper.chm > Basic Workflows > Code Generation > Attributes. Does this help?

Zero-G.
Posts: 391
Joined: Sat 09 Dec 2006 12:20

Re: How to set IsUnique within Entity Developer

Post by Zero-G. » Tue 24 Nov 2015 12:10

Hey
THX. - I still tried this. But I can't find the IndexAttribute from within the DataAnotations.Schema Namespace.

https://msdn.microsoft.com/en-us/librar ... .113).aspx
Here a Picture, which possibilities I have to choose from

https://onedrive.live.com/embed?cid=7D6 ... 7puvX9DXCs

Please give me advice, how to do it right. - THX

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: How to set IsUnique within Entity Developer

Post by Shalex » Tue 24 Nov 2015 16:30

Have you added EntityFramework.dll assembly with its attribute types via the Model Settings window > Attributes?

Zero-G.
Posts: 391
Joined: Sat 09 Dec 2006 12:20

Re: How to set IsUnique within Entity Developer

Post by Zero-G. » Tue 24 Nov 2015 17:43

THX
That solved the Problem.
But for Information:
The Visual Basic Template for Self-Tracking Entity isn't working correct after adding the EntityFramework.dll for the aspects.
The reason is, that The Property EntityState is getting ambigous. And so all properties have to been set explicit to Data.EntityState.

Have a nice day!

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: How to set IsUnique within Entity Developer

Post by Shalex » Wed 25 Nov 2015 15:24

Zero-G. wrote:The Visual Basic Template for Self-Tracking Entity isn't working correct after adding the EntityFramework.dll for the aspects.
The reason is, that The Property EntityState is getting ambigous. And so all properties have to been set explicit to Data.EntityState.
Please send us a small test project so that we can reproduce the issue in our environment.

Post Reply