0
Hello, everybody
I wanted to know a way, or better, if there is a way to find out through a SELECT the type of relationship between two tables wanted me to return.
SELECT TABELA_PRINCIPAL, TABELA_RELACIONADA, COLUNA_PRINCIPAL, COLUNA_RELACIONADA, TIPO_RELACIONAMENTO FROM (...)
in TIPO_RELACIONAMENTO
could come as flag (1 = One to One, 2 = One for many and 3 Many to Many, 4 without relationship). This is for Mysql database and Sql Server.
'Cause I’m developing a class generator Models particularly in Console Application. Maybe you can ask yourself, "why not use Code First with Reverse Engineering?" because well I’m doing a particular why in this mine Console Application I can treat the class name and the columns name for convention reasons, whereas Code First with Reverse Engineering does not do this: it simply generates the classes from the bank with the names of the tables of the bank, and depending on the name of the tables comes out each caca in the model, you know what I mean?
My generator is already generating the access layer with Repository Pattern Generic, Models with the Mappers and Dataannotationing, all automatic, only that they simply don’t come with relationships within the Mappers classes. Needed this.
I’m doing it in the nail because I still can not know how is done the process of reading the schemas and Relationship of the bank through the Fluent Api.
Anyone who can help I’m grateful.
Have you tried modifying the Entity standards? https://msdn.microsoft.com/en-us/data/jj819164.aspx http://www.entityframeworktutorial.net/EntityFramework6/custom-conventions-codefirst.aspx
– Alexandre Borela
Hello, I’ll take a look, and comment again from there! , thank you!
– Rodrigo