Note that there are some explanatory texts on larger screens.

plurals
  1. POStatic methods, non static members - Data Access Layer/Business Layer
    primarykey
    data
    text
    <p>OK, i am creating a web application. I am using MVC3. I have ViewModel for every view and also I have Data Model that supports viewModel and does the actuall CRUD operation in my sql table, while my viewModel validates and alters data as necessary.</p> <p>Here is a question. The way I have been coding is</p> <pre><code> public class MyClassViewModel { public string member1{get;set;} public int member2{get;set;} public static GetAllMembers(MyClassViewModel obj, out string strErrMsg) { // code goes here, read operation } public static UpdateMyClass(MyClassViewModel obj, out string strErrMsg) { // code goes here, write operation. } } </code></pre> <p>Both My ViewModel and DataModels have been coded this way, My Controller on HttpPost just do something like this..</p> <pre><code> MyClassViewModel.UpdateMember(obj,out strErrMsg) </code></pre> <p>Since its mvc on every post it creates on a strongly typed view, a new object of my ViewModel, hence non static members are different and are not shared between sessions.</p> <p>I am using Linq and therefore on each static method of my DataModel i use</p> <pre><code> var db = new MyApplicationDataContext() </code></pre> <p>to get my linq classes and work on them. This solves my open/close reader problems.</p> <p>My question is, are there any issues regarding concurrency with this design? I know I might have problems in changing my data layer if it is not designed via interface, but I highly doubt that is necessary based on my application.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload