When using ASP.NET MVC and LINQ, should you be creating stored procedures in your SQL database? -


this don't understand. conventional wisdom stored procedures create them if know know query executed part of application , can describe in terms of paramaters (which 99.9999% of time .. other 0.0001% being if create application in queries unpredictible because user writing queries or something). if -- set triggers, cascade deletes, sprocs -- when create database, point of having model? purpose model serves in case tell database "go!" , database performs logic. makes m in mvc irrelevant.

sorry if seems opinion-based quesiton, feel i'm not getting gist of asp.net mvc if on 1 hand i'm being told "make database handle logic possible" , other hand have these tools linq, entity, etc., creating c# way of querying database.

are asp.net mvc , stored procedures antonyms?

firstly, asp.net mvc , stored procedures not antonymous. not related. not mean cannot both in same application.

i'd think of mvc design pattern presentation/ui. m in mvc entity you'd represent. can simple login model holds username , password, or larger model represents social media user, status updates, list of friends , status updates. small apps, model match datasets; in case, model can datasets. in larger apps, model represent business objects, not correspond underlying datasets.

a lot of asp.net mvc examples small apps use datasets models. not design use on larger applications want de-couple database presentation layer. in such case, model business objects, , sit on business logic layer may different data access layer. in case, model not aware of database, nor aware of whether use stored procedures or linq queries.

it possible asp.net mvc application retrieves , updates data through application's api. in case, mvc application's model data api returns or accepts. api handles model retrieval , persistence.

so m in mvc can not datasets in database.

as queries, yes practise run of queries on data server because data server designed that. , can make data server return data application needs. can achieve either using stored procedures or linq. have preference on using linq on stored procedures. avoid stored procedures if can. that's preference. preference not put business logic on stored procedure.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -