Read oracle table default value from entities.

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Posts: 1
Joined: Tue 14 Sep 2010 11:37

Read oracle table default value from entities.

Post by mxa055 » Wed 15 Sep 2010 06:41

I am using EF4.0 with Oracle 11g.
Using MS EF (edmx) I cannot retrieve a column's default value so I tried Entity Developer producing a edml file. There I can see the default value in the respective properties, but how can I retrieve that value at runtime so that I can show it on a data entry form?

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 15 Sep 2010 16:10

Here is the code that obtains the default value from the conceptual metadata workspace:

Code: Select all

MetadataWorkspace workspace = context.MetadataWorkspace;
object value;
var item = ws.GetItems(DataSpace.CSpace).Where(i => i.Name == "MyEntity").Single();
value = item.Properties.Where(p=>p.Name == "MyProperty").Single().DefaultValue;

Post Reply