Create a default value for a property using fluent interface

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
gavs
Posts: 1
Joined: Mon 31 Oct 2011 05:02

Create a default value for a property using fluent interface

Post by gavs » Mon 31 Oct 2011 05:09

Im using EF 4.1 code first. I need to define a sequence to use for Oracle when an insert is made for an auto generated column.

This post:

http://www.devart.com/blogs/dotconnect/ ... ggers.html

Shows me how to do it with configuration:

devart:DefaultValue="MY_SEQUENCE.NEXTVAL"

But how would I define this using the fluent interface?

Thanks

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

Post by Shalex » Tue 01 Nov 2011 15:02

Microsoft doesn't allow to set DefaultValue in the current versoin of Code-First fluent mapping.

As we understood, you have a database. In this case you can generate a model for your database in Entity Developer, add the DbContext code generation template, and work with DbContext (without fluent mapping). DefaultValue can be used in this scenario because there is an XML-mapping.

We have removed your another post ("How to use a sequence default value with code first") as it is duplicated.

Post Reply