Contact Us
Forum Home
>
DevForce
>
DevForce 2010
New Posts
FAQ
Search
Calendar
Register
Login
Constrains in DataBase.
Post Reply
Author
Message
Share Topic
Printable Version
Delicious
Digg
Facebook
Furl
Google Boomarks
Google Buzz
MySpace
Newsvine
reddit
StumbleUpon
Translate
Twitter
Windows Live
Yahoo Bookmarks
Topic Search
Topic Options
Post Reply
Create New Topic
rbautistaole
Members Profile
Send Private Message
Find Members Posts
Add to Buddy List
Newbie
Joined: 01-Apr-2011
Posts: 37
Post Options
Post Reply
Quote rbautistaole
Report Post
Quote
Reply
Topic: Constrains in DataBase.
Posted: 10-Jul-2012 at 7:00pm
Hi.
In DevExpress.XPO i can mark a property with a attribute as
[Indexed
(
"CampoB"
, Unique =
true
)]
public int CampoA {
to generate a composed index (campoA, campoB) on the database either unique or not.
Do Devforce has some equivalent?
thanks.
sbelini
Members Profile
Send Private Message
Find Members Posts
Add to Buddy List
IdeaBlade
Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options
Post Reply
Quote sbelini
Report Post
Quote
Reply
Posted: 12-Jul-2012 at 10:02am
Hi,
If using Code First, you can create the index in the DbContext: (
http://stackoverflow.com/questions/4995642/add-index-with-entity-framework-code-first-ctp5
and
http://stackoverflow.com/questions/4413084/unique-constraint-in-entity-framework-code-first
)
public
class
Initializer
:
IDatabaseInitializer
<
MyDbContext
> {
public
void
InitializeDatabase(
MyDbContext
context) {
...
context.Database.ExecuteSqlCommand(
"CREATE INDEX..."
);
}
}
In Model First/Database First, unfortunatelly there's no equivalent for the "Indexed" attribute in DevForce. (Actually EF does not support it)
Regards,
Silvio.
Post Reply
Forum Jump
-- Select Forum --
Community Forum
Community Forum
Community Forum now on StackOverflow
DevForce 2012
DevForce 2010
DevForce 2009
DevForce Classic
Forum Permissions
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
delete your posts in this forum
You
cannot
edit your posts in this forum
You
cannot
create polls in this forum
You
cannot
vote in polls in this forum