1

I have an one entity in my edmx model having an one property that can contains huge XML data.

Basically I want to load this entity without this property (column) /* huge data loading */ . And load this column only when it is strictly needed.

I have tried to create an inherited entity containing this property and remove this property from base entity (original entity). I have done mapping. At this time I have problem, that during compilation a I get error, that base entity is not capable to insert and update itself, because property is not nullable

I am looking for best approach (solution) how this situation should be solved.

I am attaching the cut-out from my emdx designer (containing my current and desired situation)

EntityFrameWork view

UPDATE:

I will try to write a procedure that I have tried: I mapped functions to my custom functions. For entity TRP_TechReport_T without the XML column (property). Then I just mapped for entity TRP_TechReport_T functions to my custom function (containing XML column).

Then I set Mapping condition on the entity TRP_TechReport_T: When TRP_XML = Empty.String

TechReport_T mappings: TechReport mappings

TechReport_T functions: enter image description here

TechReportFull_T mappings: Entity TechReportFull_T mappings

TechReportFull_T functions: TechReportFull_T functions

At this moment I get error:

Error 2 Error 3032: Problem in mapping fragments starting at line 3754:Condition member 'TRP_TechReport_T.TRP_XML' with a condition other than 'IsNull=False' is mapped. Either remove the condition on TRP_TechReport_T.TRP_XML or remove it from the mapping.

The column is not nullable in the database and mustn't be.

I can hard-set XML property to nullable, but in the case of the model updating from the database information will be lost.

At the moment it's the only thing I could think of.

Martin Majoroš
  • 409
  • 1
  • 6
  • 17
  • Have a look at [Entity Framework lazy loading](http://stackoverflow.com/questions/4647931/entity-framework-lazy-loading) – Bob. Nov 22 '12 at 12:53

0 Answers0