Print Page | Close Window

How does one use LoadMetadataFromEmbeddedResources?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2906
Printed Date: 25-Apr-2025 at 10:29pm


Topic: How does one use LoadMetadataFromEmbeddedResources?
Posted By: jradxl
Subject: How does one use LoadMetadataFromEmbeddedResources?
Date Posted: 18-Aug-2011 at 4:08pm
Hi,
How does one use,
IdeaBlade.EntityModel.EntityMetadataStore.Instance.LoadMetadataFromEmbeddedResources(assembly);

Any possiblity of doing this sort of thing, if probing is not possible?
IdeaBlade.EntityModel.EntityMetadataStore.Instance.LoadMetadataFromAnyModelAssembly(assembly);
thanks
John




Replies:
Posted By: kimj
Date Posted: 23-Aug-2011 at 7:09pm
Why do you want to call this directly?
 
It's actually something used internally by DevForce when looking for and initializing Code First models.  The method will search for any *.ibmmx files embedded in the given assembly and merge the contained metadata into the EntityMetadataStore.  This all happens automatically, or is supposed to, whenever a new entity type is seen in a query or save list.  The assembly normally passed into the method is one holding entity declarations, so should already be probed.
 
If you're seeing a problem with your Code First entities, please let us know the details of the problem.   
 


Posted By: jradxl
Date Posted: 24-Aug-2011 at 1:11am
Hi,
Thanks for response. Idle interest really! I noticed it and was wondering why there wasn't a family of such methods!

I was trying to get the metadata from within a T4 template, but the metadata store instance was returning nothing.
var et =  IdeaBlade.EntityModel.EntityMetadataStore.Instance.GetEntityTypes();
I suppose the MEF probing couldn't operate correctly.

Since then I've moved over to a PreProcessed T4 template and it's working fine.

thanks
John



Posted By: kimj
Date Posted: 24-Aug-2011 at 7:22am
That's great that you found an answer to your issue with the preprocessed templates.
 
Regarding MEF probing - at design/build time the only way to have MEF probe an assembly is to add it to the IdeaBladeConfig ProbeAssemblyNames collection, since the normal MEF probing is turned off.



Print Page | Close Window