EF Model First or Code First Approach?

后端 未结 4 1716
情歌与酒
情歌与酒 2020-12-04 10:38

I know this question has been asked numerous times before as I’ve read quite a few posts on the topic about the pros and cons etc but I still can’t decide which approach is

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 10:40

    You can use the model first examples from any version of MVC, if that is your primary issue with model first. The way MVC handles "models" is not really different across versions. Sure, there are enhancements to the view model, etc., but you should be fine with older tutorials.

    I prefer the code first, as I feel there are database models and domain models and they serve different purposes. Database organization is for performance and size on the database and not to help your application. Having your own model allows you to focus on state needs in your application, regardless of the database.

    Now, you can get to this model from model first, but you are more likely to think about the database than your needs in this manner ... esp. if you are a newbie at this.

    Just my 2 cents.

提交回复
热议问题