loresoft / EntityFrameworkCore.Generator

Generate Entity Framework Core model from an existing database

Home Page:https://efg.loresoft.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specify Schema folder in config

VinayShiva opened this issue · comments

While composing the yml file we specify which schema's to use.

tables to include or empty to include all

tables:

schemas to include or empty to include all

schemas:
- Asset
- Party
- Event
- Customer
- Order
- Venues
- Ref

Now i want to specify folder per schema.

entity class file configuration

entity:
namespace: "{Project.Namespace}.{Schema}.Data.Entities" # the entity class namespace
directory: '{Project.Directory}{Schema}\Data\Entities' # the entity class output directory

is this possible or the option is to create multiple yml files and stitch the results manually.

This is a good idea. I'll work to get support for a {Schema} variable added

Hi, I tried using schema as a variable as you suggested.
I found this to be very difficult to get right.

The naming should only be a unique per namespace. example: Shema1.Person should not conflict with Schema2.Person, which I think is the whole point of this feature.

Instead of using a variable I set added an option: "AddSchemaToNamespace"

You can check my changes here:
BartBr@7a9cc2f

Looking through the changes you suggested that is exactly what I was looking for, we have a number of tables that are identical in name but differ only by schema and keeping them in separate folders and namespaces would allow for us to use this generator, without resorting to separate contexts or using the prefix schema option, I really hope this is accepted.

I created the PR #99

@pwelter34 Hi Paul, could you take a look at my pull request #99?
By any means this feature meant to be nonintrusive, if you don't enable this feature, it has no effect on the rest of the program.

Thanks

thanks for reminder. i'll take a look this weekend.

This is implemented in v3

To use the schema in a namespace, directory or class name use the new {Table.Schema} variable in the configuration file.

Documentation: https://efg.loresoft.com/en/latest/variables/\
Sample: https://github.com/loresoft/EntityFrameworkCore.Generator/tree/master/sample/TrackerSchema/TrackerSchema.Core