Hello, I recently got acquainted with this technology, and, probably, due to the fact that I know little about it, there is 1 slightly strange question. I understand that CodeFirst is a cool solution that allows you to fully develop the object model, which will then be displayed in the tables of the physical database. But the question is, what if the object model that I want to use in my code is not a direct mapping of the database tables? What I mean ? For example, the database I have is broken into some entities, and I have a composite object from the tables, but not all the fields of these tables contain. It turns out that I will have to first create objects that are a direct mapping of the database, and then still create a new object that will partially repeat the code of those objects. Just the concept CodeFirst itself as I understand it assumes that the objects are a direct mapping of the database and further work It was produced with these objects, but it does not always work out this way. Perhaps I wrote nonsense here.

Thank.

    1 answer 1

    No, not nonsense, why? Good question.

    CodeFirst can be configured by specifying annotations and in the code ( [1] , [2] ) which tables will be created, and how they will be displayed on your data. (For reference, this will be done by default.)

    Hope this helps.

    • Yeah, thanks, it helped. - nvse
    • @nvse: please! - VladD