ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.11k stars 292 forks source link

.dacpac views #387

Closed WeberEric closed 4 years ago

WeberEric commented 4 years ago

Hi,

the support of dacpac to generate the classes is great. But the views are missing. Bug/Feature i don't know. :-)

Eric

ErikEJ commented 4 years ago

It is not possible to generate views from a .dacpac, no data type information is available.

WeberEric commented 4 years ago

Hi Erik,

ok, i see. I haven't checked the method yet with which you parse/read the dacpac. I create my dacpac with a VisualStudio database template project. And this project creates a dacpac with a model.xml file. I don't know if this is mandatory for every dacpac.

Unter the key: DataSchemaModel-->Model-->Element (SqlView)-->Relationship-->Entry-->Element (SqlComputedColumn)-->Relationship-->Entry-->References you can find the key (name property) to get the original column (with schema and table name) with the original type.

I dont't know if this method works with all possible cases but for the 90% default cases this will work i think.

I hope this helps. Please let me know if you need further information.

Eric

ErikEJ commented 4 years ago

I use DacFX - I will give it another try.

ErikEJ commented 4 years ago

@WeberEric
I have attempted to fix this in the latest daily build, thanks for convincing me this could be done! Please try it out and let me know if it works for you.

WeberEric commented 4 years ago

@ErikEJ Thanks but the views are not displayed. Right click on the Project --> EF Core Power Tools --> Reverse Engineer --> select .dacpac project [Use EF Core 3.x] --> OK --> the views are not displayed. I also tryed to debug it but there are no changes on the relevant methodes. I tryed the latest code from master and the latest build from 'VSIX Gallery'. Any Ideas.

Eric

ErikEJ commented 4 years ago

Ah! I need to show them also - coming up!

WeberEric commented 4 years ago

Now it works thank you. :-)

Now i found a new smaller problem. The generator does not use the alias of a column. It uses the referanced table column name.

ErikEJ commented 4 years ago

Please log a new issue, and it would be useful if you could attach a .dacpac that reproduces the issue.

ErikEJ commented 4 years ago

I managed to find the bug - hold your horses!

ErikEJ commented 4 years ago

Now i found a new smaller problem. The generator does not use the alias of a column. It uses the referanced table column name.

I am unable to get that information from the .dacpac it seems, let me know if you conclude otherwise.

WeberEric commented 4 years ago

Thank you for your tray. I don't know if it is possible with your library but with the raw data (model.xml) it is possible. I think you get it but only for clarification I attached an image with 1/2; 1 is the alias (Name to use in the generated class) 2 is the original name/key to get the type. Thanks Eric

ScreenShot_2020-05-27_11-18-32

ErikEJ commented 4 years ago

I have created issue https://github.com/ErikEJ/EFCorePowerTools/issues/393