C# Code First Vs. SQL Database first when using a business logic layer

56 views Asked by At

I am firmly in the camp of being a database first developer. I believe there are pro's and cons' to each approach. However when creating a code first approach should the newly created classes have default values set?

E.g.

public DateTime DateCreated {get; set;} = DateTime.Now;

If so what is the need for an existing business logic layer when the above property is not being referenced anywhere in the controller or business layer methods.

Another point is the mere fact that if code first migrations are enabled on commented out code the column is dropped!

Data is precious.

1

There are 1 answers

2
Stefano Buzzoni On

Business logic layer works as a medium from presentation layer and data access layer, so if a request in the business layer points to your property it gets fetched by data layer and returned