Hi. How do I know that the DB table has a column: TypeId for some entity? I write data directly in DB from xml. This xml doesn't has TypeId attribute and for my custom query i should know, add TypeId to query from code or no.

asked Jan 31 '11 at 07:25

Anton%20Guschin's gravatar image

Anton Guschin
73303035

edited Jan 31 '11 at 08:26

Hello Anton and welcome to the DataObjects.Net community.

Could you please explain the scenario you faced with? This would be very helpful. I'd recommend you to edit this post and add the necessary details.

Thanks in advance.

(Jan 31 '11 at 07:31) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

Anton,

A DB table doesn't have the TypeId column in case the corresponding Entity has ConcreteTable inheritance scheme. In runtime it can be found by this code snippet:

var customerTypeInfo = domain.Model.Types[typeof(Customer)];
var inheritanceScheme = customerTypeInfo.Hierarchy.InheritanceSchema;
if (inheritanceScheme == InheritanceSchema.ConcreteTable)
  // TypeId column is absent

Hope that helps.

answered Jan 31 '11 at 09:26

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Oh, great! It's works for me. Thanks.

(Jan 31 '11 at 09:59) Anton Guschin Anton%20Guschin's gravatar image

It's a pleasure =)

(Jan 31 '11 at 10:01) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×5

Asked: Jan 31 '11 at 07:25

Seen: 5,110 times

Last updated: Jan 31 '11 at 10:01

powered by OSQA