MVC :: Dependency Inversion Between Layers?
Nov 1, 2010
Split off from http://forums.asp.net/t/1618613.aspx
I would like to get your advise on Dependency Inversion..Should i include it as a layer between Business Layer and Repository Layer?
I think its really great when different team members work on DAL n BAL etc or when your database will be changed in future. It actually removes the dependency of the Data provider but over the expense of additional coding overhead. My question is , is it really worth it? If i suggest this layer to my PM and give him the above two reasons then i dnt think he will accept it since most of the time each developer works on his DAL/BAL's, and Change in DB wud be the least of his concerns.
RAD in every layer..
I mean if there are any auto generation tools available for generating repositories etc.I read about MVCContrib Grid and i think its a good option to use for Grid.
If i use Spark ViewEngine then can i still use T4 templates to auto create custom views by customizing templates?
View 2 Replies
Similar Messages:
Feb 25, 2011
how the WCF, DAO and DTO layers communicate with each other? I would appreciate if someone can specify which layer comes first and then how it interacts with the next layer
View 1 Replies
Mar 7, 2010
I have a form with mulptile panels hidden behind others. It is impossible to edit them in design mode without moving them to the side so that all panels are visible, so that is what I do. I use JavaScript to position the panels during runtime, but it is an innefecient way to do it.
Is there a way to make a panel or layer visible or invisible while working in design mode, kind of like autocad works
View 1 Replies
Nov 18, 2010
I want to use Linq to SQL in my web projects. I mostly work in small and medium size projects. Please guide me what layers I should use ?
Previously I was using DAAB and was using 4 layers (business objects, business logic layer, data access layer and user interface).
View 5 Replies
Apr 19, 2010
I am using layered architecture in dotnet (mostly I work on web projects). I am confuse what layers should I use ?
I have small idea that there should be the following layers.
user interface
customer types (custom entities)
business logic layer
data access layer
My purpose is sure quality of work and maximum re-usability of code.
some one suggested to add common types layer in it. Please guide me what should be layers ? and in each layer what part should go ?
View 5 Replies
Nov 4, 2010
While designing (and then implementing) a layered application:
Is it correct to use the same ORM objects accross all layers? (which would go against encapsulation).
Or the presentation, business and data layer should each have their own objects? (which would lead to lots of code repetition).
e.g. (just to illustrate the question): if one uses Linq to SQL in the Data Layer and Visual Studio's O/R designer to generate the ORM objects, are those objects supposed to be used in the Business and Presentation Layers as well.
i.e.: Are the objects associated with the entities that the application handles a crosscutting issue?
View 1 Replies
Jul 6, 2010
I have three layers like UI, business and data access in my asp.net web application project. If I pass say a company code from the UI to the business to the data access and I query the company details like company name, address, phone etc from the database using sqlhelper executedataset() which wil return me a dataset. Then how do I pass these company details back to the UI layer. Is it correct to just pass the datatable object to the business and UI.
View 6 Replies
Jan 26, 2010
I'm trying to create my first Asp.Net application from scratch. Tried to create this post in some of the other forums but I couldn't find a better place.
So, as the title says, I'm having trouble trying to model my application. I'm like an OOP newbie. I'll show my classes first and then I'll write my questions.
Model Layer
public class User
{
private int id;
public int Id { get { return id; } set { id = value; } }
private string login;
public string Login { get { return login; } set { login = value; } }
private string password;
public string Password { get { return password; } set { password = value; } }
}
Data Access Layer
public class BasicDAL
{
private SqlConnection connection;
//>>Returns a new connection to the database
public SqlConnection GetConnection()
{
//>>If connection is active close it before starting a new one
if (connection != null)
if (connecion.State != ConnectionState.Closed)
connection.Close();
connection = new SqlConnection("MyConnectionStringHere");
return connection;
}
}
public class UserDAL : BasicDAL
{
//>>Insert a new user
public void Insert(User user); { /* Insert into DB */ }
//>>Authenticate user login with its password
public void Authenticate(User user); { /* Authentication code here */ }
}
Business Logic Layer
[Code]....
So, model layer is pretty simple. Just a user representation. On the Data Access Layer I have a basic class with a GetConnection method. All DAL classes will extend this one.
My first problem lies on Business Logic Layer. With the above scenario, I've placed the same methods that I placed at the DAL. BLL methods would call DAL. As simple as that but I believe It is not the best way to do it, is it? How can I improve those classes?
Also, I have to "try..catch" blocks. That's because I can't find good places for it. I mean, if I place a try..catch on GetConnection method, for instance, how my ASPX page would get this error? How my ASPX page can tell the difference between "database offline" and "sql syntax error" when executing "userBll.Insert(newUser);".
My problem is mainly placing the exception handlers. I understand I would probably have to change return type of some methods. I didn't change because I believe that will have something with the exception handlers.
Btw, please assume I can't use TableAdapters and stuff like that. I would like to create all layers by myself.
View 3 Replies
Jan 3, 2010
I am trying to work out the best way of dealing with a mailinglist class I have written. I got a simple form on the page where people can add their email address. Depending on which page they add their email address they join a differnet mailinglist. So from the form I have 2 values passed to the DAL {mailinglistID} and {email} - Various checks are done in the DAL, such as checking if email exists, checking if email exists in that mailing list etc etc.
I would like to be able to present the status codes on the page, so in the DAL I return a number value and from the BLL return a string depending on the number value. DAL returns 1, means email exists in mailing list, BLL see's the 1 and returns "email exists" to the page.
I have no idea if this is the right way of doing it or not - the (problem or question) is that in the content page I am checking the if the returned string is "" or has a value, and presenting the message in a visable div.
Is this the best way to do this, or should the status value be converted to a message on the code behind of the content page.
(of course I could have got this all wrong, and need to start again.
View 3 Replies
Mar 25, 2011
i am creating a class library project and adding new ado.net data model into it. created model automatically generetes codes. ModelENtities and entity classes.
i want to separate ModelEntities context class and entity calsses to two layer as two class library. is this possible?
assume that I do this and when I update the model from database , do separated classes update?
View 1 Replies
Jan 14, 2011
I have a theoretical question.i have a function in DAL that does a select sql query. and these are my questions:
I was told that it's not appropriate to pass datasets between layers. so how should i pass the results? which value should i return to the BLLBAL (i thought of a List<>).? and to the presentation layer.
currently my implemention is like that:
SqlCommand cmd = new SqlCommand("getRequestById", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@requestId", rId));
SqlDataAdapter datAdp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
datAdp.Fill(ds,"getRequestById");
List<String> rs = new List<string>();
for (int i=0; i<11; i++)
{
rs.Add((Convert.ToString(ds.Tables[0].Rows[0].ItemArray.GetValue(i))));
}
return (rs);
is it better to create xsd file in VS2010 with only fill (all other implemtation i'll do on my own) property.
I added New Item, DataSet, over that i added tableadapter with stored procedure. i declared that it will do only the fill property(without returning the data). i want to implement all the other properties by demand in my way.
i wrote in the dal test.getRequestById1DataTable dt1 = new test.getRequestById1DataTable() how can i get the data and pass it between the layers?
View 4 Replies
Mar 5, 2010
If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer?
Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?
View 6 Replies
Sep 3, 2010
I have a query about asynchronous paging using RegisterAsynchTask or AddOnPreRenderCompleteAsync
If I have a 3 tier web application with the UI, Business Layer and the Data Access Layer and I'm doing the Begin and End asynchronous processing of a method at page level (UI). This UI method accesses the DB and goes through all the layers starting asynchronously from the first page, then continuing "normally" through all the other layers. These underlying layers are all synchronous but started asynchronously through the first Page.
My question is how should asynchronous paging processing be handled with regards to layers? Do I need to set the methods being used at all levels asynchronously (using Begin and End event handlers) ?
And what about MasterPages... I can't Asynchronous processing for them. RegisterAsynchTask is not available and neither AddOnPreRenderCompleteAsync.... what I'm missing?
View 5 Replies
Mar 13, 2010
Here is the scenario.
Every project has a Supervisor.
When I select the supervisor for a particular project, I'm using a dropdownlist.Table is like this
ProjectId | SupervisorId | ......
--------------------------------------
1 | 1
In my application, I'm binding a Collection of Supervisor type, which I'm feeling that it is an additional overhead. Becuase I only want his ID. So binding an object collection to the dropdown which seems no worth.
View 5 Replies
May 19, 2010
I am thinking to use entity model as DAL, how should I create the BLL then? What kind of datasourceobject should I use in the asp pages?
I am looking for best practice to use Entity framework 2 in the three layers design. I had experience at dataset with three layers design.
Should I use objectdatasource at the pages for gridviews? My guess is that entitydatasource by passed the BLL which is not good, so the only option left is the objectdatasource.
Could and should my BL object inherit those entity model in the DAL, so I dont need to recreate their object's property?
View 4 Replies
May 17, 2010
How can I share the auto-generated entity data model (generated object classes) amongst all layers of my C# web app whilst only granting query access in the data layer? This uses the typical 3 layer approach: data, business, presentation.
My data layer returns an IEnumerable<T> to my business layer, but I cannot return type T to the presentation layer because I do not want the presentation layer to know of the existence of the data layer - which is where the entity framework auto-generated my classes.
It was recommended to have a seperate layer with just the data model, but I'm unsure how to seperate the data model from the query functionality the entity framework provides.
View 2 Replies
Apr 1, 2010
I have question about N-tier architecture. everyone about 3-Layer architecture these are:
1). UI Layer,
2). Business Layer,
3). Data Access Layer.
i already have worked on this.
Then i heard about LINQ to sql. how many layer an web application should contain.
As my knowledge. if i use LINQ to slq then i have to worked only 2-Layer:
- Data Acess/Business Layer: which contains only *.dbml files which is my database and
- UI Layer: which contains *.aspx files.
View 3 Replies
Dec 23, 2010
I have a quick question in regards to testing my validation. I have been looking through a few MVC examples and have noticed the 'Validating with a Service Layer' tutorial which is pretty nice. It discusses how to abstract your code out etc..My question is, that they have validation occuring in the service layer, if errors occur, the error + message then gets added to a model state dictionary.Now i want to test my model to make sure my business rules are being applied to it, but with this approach, for starters, the Validation method is not in the interface. Now, if the validation method was in the interface, during testing you would have to re-implement the validation on the testing side.Am i missing somthing? Where should your validation code go? I feel like it should go in the model, but then i have to track the errors on the model side.
View 1 Replies
Mar 3, 2011
N - Layered Application: One class library for all layers or for each layer?
View 5 Replies
Feb 18, 2010
I doubt how to implement the layers
FACADE, BLL and DAL, using
DTOs specialized ..
where:
public class ClassA
{
private int _Test1;
public int Test1
{
get { return _Test1; }
set { _Test1 = value; }
}
}
public class ClassAB : ClassA
{
private int _Test2;
public int Test2
{
get { return _Test2; }
set { _Test2 = value; }
}
}
public class ClassAC : ClassA
{
private int _Test3;
public int Test3
{
get { return _Test3; }
set { _Test3 = value; }
}
}
In the database, there is the 3 tables, as described above.how do I implement the facade, bll and dal? only one class for 3 DTOs?
View 3 Replies
Apr 23, 2010
We have many instances in our application where we would like to be able to access things like the currently logged in user id in our business domain and data access layer. On log we push this information to the session, so all of our front end code has access to it fairly easily of course. However, we are having huge issues getting at the data in lower layers of our application. We just can't seem to find a way to store a value in the business domain that has global scope just for the user (static classes and properties are of course shared by the application domain, which means all users in the session share just one copy of the object). We have considered passing in the session to our business classes, but then our domain is very tightly coupled to our web application. We want to keep the prospect of a winforms version of the application possible going forward.
View 3 Replies
Jun 24, 2010
It's appreciated if you could share your thought.I have seen a e-commerce website design which have a few layers:Common,DataAccess,BusinessLogic,Operational.In the Common layer,it includes all the classes with only attributes and properties,no methods nor data access codes here.
In the DataAccess layer,there is a class for each action per class in the Common layer.For example,
a class for the Select action of class A of Common layer,
a class for the update action of class A of common layer,
a class for the Select action of class�B of Common layer,
etc...
Is this a design I could use for a potential high trafic website?What's the pro and con of this design.
View 3 Replies
Mar 26, 2010
where I can find a good generic tutorial on persistence data access layers?
View 2 Replies
Apr 27, 2016
I need to show infowindow for the markers when clicked on gridview row. This link [URL] because i tried this way but could not show marker on map.
View 1 Replies
Jul 5, 2010
I think there are some steps to enable SQL Cache Depdndency :Enabling notifications, changes in web.xml and then using Cache Dependency object.
View 2 Replies