0

This is more of a general question about usual practice of code first approach.

So using Sql server we can write a complex queries using stored procedure create views and user-defined functions, built-in functions and dynamic sql so on and so forth.

For most of web-sources I have been looking on code-first approach, it just maps your tables to the Sql server using context.

But it seems it's quite limited in my perspective of views, meaning that it seems I can't use the full feature of sql side languages using entity framework alone.

I know that you can generate code-first from existing databases and stuffs.

But let say I want to write a stored procedure.

I saw that you can customize and map to stored procedure on update, delete and create, but let say I want to write a stored procedure that joins two tables and do multiple things, may be updating and deleting some series of base tables.

Can I do that in entity framework? I know the designer model can import stored procedures and functions and stuffs, but it seems that using code-first approaches, all I can really do is create some relational tables and map it.

Do I configure these things on SQL sides? I know you can use LINQ for simple joins and stuffs as a matter of fact, but what if I want to write a queries because the logic is quite complex? Is there any way to use these sql features using code first?

daf
  • 21
  • 3
  • 1
    the benefit of code first approach is that you can version your database easily – Muhammad Anas Jun 15 '17 at 05:48
  • You can use database projects to version databases more easily now (Probably not as easily as code first though). This is an interesting read: https://stackoverflow.com/questions/5446316/code-first-vs-model-database-first If you have any level of appreciable logic in your database, I suggest database first – Nick.Mc Jun 15 '17 at 05:53

0 Answers0