Linq2DB - Generate Data Model for a given schema only

615 Views Asked by At

Trying to Linq2DB for the first time - I have DB with multiple different schemas. Only a selected schema needs to be ORMed. Currently, it is generating multiple classes, some of which are duplicates. I have same tables across schemas.

so, how do I filter out schemas that I don't want ?

1

There are 1 best solutions below

2
On

You can filter out not needed schema in T4 template. According to documentation https://linq2db.github.io/articles/T4.html

GetSchemaOptions.IncludedSchemas = new[] {"some_schema"};

// or by exclusion
GetSchemaOptions.ExcludedSchemas = new[] {"some_unwanted_schema"};

LoadMetadata(...);

GenerateModel();