开发者

.NET EntityStoreSchemaFilterEntry filter patterns

First question to SO, I hope I'm doing this right. ;)

Regarding System.Data.Entity.Design.EntityStoreSchemaFilterEntry :

I'm looking for some detailed documentation on this class. The MSDN docs have nothing but an indication of what properties exist and their data types. I want to create a well-defined list of filters for

EntityStoreSchemaGenerator.GenerateStoreMetadata(
   IEnumerable<EntityStoreSchemaFilterEntry> filters
)

Specifically:

  • Do we need to set all Excludes before the Allows so that Allow entries are the only ones that are returned开发者_C百科?
  • What are the consequences of using null in any of the parameters? What about empty string "" ? Comments about this seem to be conflicting and don't match my experience with their usage.
  • Is the proper "all" wildcard a simple "%"?

My goal is to Exclude all Tables, Views, and Filters, then Allow just the ones that I want. If I try to do this I get an edmx file with no entities. It seems my Exclude All takes precedence over all of the tables that I tried to include. If I don't try to exclude tables that I don't want, I get the tables I've Allowed plus all other tables in the database, which sort of renders filtering useless.

For reference, the only info I can find about proper wildcard patterns for filters is here: http://msdn.microsoft.com/en-us/library/ms710171(VS.85).aspx

Note that I've gone way beyond EdmGen, noted bugs and limitations in EdmGen2, and am now trying to accomplish what I need with a majorly extended EdmGen2 base.

Thanks!

Related keywords to assist people searching on this topic:

AEF ADO.NET Entity Framework
Tables Views Functions
EntityStoreSchemaFilterObjectTypes EntityStoreSchemaFilterEffect
EntityStoreSchemaGenerator GenerateStoreMetadata
EntityModelSchemaGenerator
SSDL CSDL MSL EDMX
EdmGen EdmGen2


I found the follow filters were sufficient to generate the SSDL for a single table.

List<EntityStoreSchemaFilterEntry> filters = new List<EntityStoreSchemaFilterEntry>();
// Just generate for the Document table.
filters.Add(new EntityStoreSchemaFilterEntry(null, "dbo", "TargetTableNameHere", EntityStoreSchemaFilterObjectTypes.Table, EntityStoreSchemaFilterEffect.Allow));
filters.Add(new EntityStoreSchemaFilterEntry(null, "dbo", "%", EntityStoreSchemaFilterObjectTypes.Function, EntityStoreSchemaFilterEffect.Exclude));

// generate the SSDL
string ssdlNamespace = modelName + "Model.Store";
EntityStoreSchemaGenerator essg = new EntityStoreSchemaGenerator(provider, connectionString, ssdlNamespace);
essg.GenerateForeignKeyProperties = includeForeignKeys;

IList<EdmSchemaError> ssdlErrors = essg.GenerateStoreMetadata(filters, version);

I only needed to explicitly exclude the functions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜