Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

ASP.NET Boilerplate with Database First #418


User avatar
0
alexandarbt created

Hi everyone,

I'have existing old ASP.NET Web forms project that is going to be "upgraded" to newer version.

It will be fresh start, and I am thinking to go with ASP.NET Boilerplate with Angular and Entity Framework. But I've found it difficult to make it work with database/model first methodology and edmx. I see ASP.NET Boilerplate follows Code-first design principle.

I've searched documentation and forums and I can't find tutorial or guidelines how to make it with database/model first. Is it possible to use your solution (N-layered, repositories, dependency injection...) principle with database first? If so, can you please provide me example on how to do it?

Thanks, Aleksandar


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    ABP is designed for new apps and database-first is not considered. I haven't try it before. I always worked code-first. You may try to generate Code-First model from database?

  • User Avatar
    0
    daws created

    I use ABP on my project with a database first model, since 2014. (and with oracle !) So yes, it's possible with some manipulations :)

    I do not use edmx files, i directly map my domain objects to the db through the db context. You can also use DataAnnotations to map your fields, or create custom mapping with something like that : public class CompanyMap : EntityTypeConfiguration<Company>

    And for class related to ABP, run the code first creation, it will provide a dbmigration file. Remove any related code from your tables, and execute only the migration with abp tables.

    But after one year, i'm migrating my databasefirst schema to a codefirst schema, it will be easier to maintain.

    I think keeping an edmx is not the best choice, because you don't fully control your mapping with your db. try to generate the code first schema from your db, like the previous post said ;)

  • User Avatar
    0
    walidabouzaid created

    @daws could you please clarify more, because I've the same issue and I could not overcome the exception.