Is it possible to programmatically query a database where DB tables relationships were added in the ADO.NET and not in the DB itself?

StackOverflow https://stackoverflow.com/questions/9227684

Pregunta

I am developing a web application in ASP.NET MVC3 with C# and Razor.

The application has to use an existing database, designed about 8 years ago where there is no physical relationship between tables. Other applications using the same DB create relationships programmatically by using joins.

In my application I created an ADO.NET model for some database's tables. Now in order to get advantage of the potentialities of inline LINQ expressions, especially the navigation properties, I would like to create relationships on the ADO.NET model.

Is ADO.NET powerful enough to translate inline expressions, where I make use of relationships, into queries understandable by the actual database where such relationships are not existing?

¿Fue útil?

Solución

The relationships in ADO.NET can be physical (having Foreign Keys constraints in the database) or logical (the relationship is defined only in the application).

You can add the relationships manually in the designer and they you will have navigation properties.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top