C# - Using Entity Framework With Existing Business Layer And Database?
Feb 2, 2011
I have an ASP.NET application with existing business classes and a database schema. (which I would like to keep) Currently I am using ADO.NET for the DAL, but I would like to switch to some advanced technology there for easier data retrieval.
Is EF applicable to my situation? Can I use it without splitting up my business classes and auto code generation? Can LINQ to SQL solve my problem better?
All I want to do is map my existing classes to the existing tables and dont have to handle details of the data retrieval myself.
View 1 Replies
Similar Messages:
Sep 20, 2010
Lets assume that I have my own business layer containing my business objects and my business services. And I have decided to create a "SilverLight Business Application" (with SL v 4.0) and I want to use my already used Business Layer from the SL application I plan to develop.
I know that I cannot include a project which is not a SL project.
View 2 Replies
Aug 2, 2010
In this website article http://aspalliance.com/1943_ASPNET_40_and_the_Entity_Framework_4__Part_4__A_3_Layered_Approach_to_the_Entit_Framework
Vince Varallo says this in his opening paragraphs. "it will introduce a pattern for developing the application as a three layered application. Notice that I didn't say three tiered application. A tier really means a logical and physical separation of the layers. A layer implies just a logical separation. For many applications that's all you need. I'm not one to advocate over-engineering a system.
I always follow the simpler, better approach as long as the developers working with you understand the pattern."
Question 1. Can some explain to me what is difference between a 3 layer application and a 3 tiered application?
Question 2. Also, can some give me a link to a simple 3 tiered tutorial for entity framework?
View 2 Replies
Sep 2, 2010
As I began writing web applications with asp.net I started with small projects that used a Linq-To-SQL mapper for database access to a MSSQL Server. After gaining some expierence I switched into a classic 3 tier with Graphic Layer, Business Layer, Data Layer. The only function of the Data Layer was to provide methods insert/update/delete without any logic and logic the form of selection methods.
Over the time I realized that it would be better not to provide the database classes up to the GUI (took some time unfortunately). I switched into using Business classes in the BL that are used for all operations performed by the BL and display by the GUI in the form of getting List from the BL. A great advantage is that I can provide additional properties that are not represented by the database itself. However, I did that mapping inside the BL myself with methods that mapped the corresponding BL class to the database class.
I guess thats where O/R mapper come in handy? Until now I haven't realized their purpose, but I think I just found it. I've recently tried out using the new Entity Framework with .net framework 4, but I'm only using it like the Linq-To-SQL DataContext.
Is there a way to achieve the mapping automatically? If yes, is that something the new Entity Framework provides or do I need to look for a O/R Mapper like NHibernate?
View 4 Replies
Oct 26, 2010
I am new to this .NET what is the difference between N-Tier and 3- Tier Architecture. If they are same. How to pass the values from presentation layer to business logic layer.
For Example
I have 10 controls in presentation layer. I passing values to these controls. How the architecture works.
View 3 Replies
Jun 24, 2010
I am building a web site following the tutorials on asp.net. I am using dataset as data access lay, and writing classes to access the dataset. But the example is just basic ideas, how do I retrieve individual table column value in the business layer?For example, if I have a table called Product, I only want to find out what is the product name by product id. I did this in my ProductBLL:
public ProductBLL
{
public int GetProductName(string productId)
{
ProductDataSet.ProductDataTable prodData = Adapter.GetProductById(productId);
[code]...
Is there a better way, or am I doing this correctly? Can anybody give me a reference to a more complicated business logic model?
View 16 Replies
Feb 23, 2011
I've even got my JQuery Ajax submission going on now but I've encountered another problem. I *think* it's something to do with the structure I'm using but like I say, I'm fairly newo this.I have my AJAX form submission which builds my "PersonViewModel" (model for the presentation layer) in JSON and sends it to "@Url.Action("RegisterSubmit")" in my Person Controller. Now, I seperate my business layer from my View/presentation layer so in "RegisterSubmit"I'm verifying the model is valid then instantiating a new instance of my business model "Person", adding the values from "PersonViewModel" and then calling my "Save" function.
View 7 Replies
Mar 7, 2011
We're building a large web app that has numerous layers. In order to communicate to the business layer we're using a service layer that the web layer calls when data is needed. Unfortunately, it seems that if exceptions are thrown in the business layer, it seems that the services on the web side are wrapping the exceptions and re-throwing them. We're looking for a clear way to encapsulate the error and log it, without WCF wrapping a new exception around the original.
View 2 Replies
Jan 26, 2011
I'm trying to reevaluate our n-layer architecture and would love to get some based on your experiences. Here is our typical .NET n-layer (sometimes n-tier) design.
Project.UI
Project.Services
Project.Business
Project.Model
Project.DataAccess
DataAccess typically consists of Entity Framework 4 and Repository classes. I attempt to follow the Aggregate Root concept in order to avoid having a repository for table, easier said than done in my experience. I tend to have ~70% match between Repositories and Tables.
Model usually consists of my Entity Framework 4 entities, I've been using Self-Tracking EF entities with success.
Business is what I struggle with the most. I typically have a Manager class for every Repository. This class will contain methods like .Add() which will perform business validation before forwarding down to repository.Add().
Services, typically I will only implement this if in fact I am looking to create a web service based solution. This layer will be tasked with marshaling requests/responses between DTOs and entities. And most importantly provide the more coarse grained interface. For example a TradingService.SubmitTrade(), which is really a facade for a business transaction which might include AccountManager.ValidateCash(), OrderManager.SubmitOrder(), etc.
My business layer is very entity centric, really it's just the glue between the entities and the repository, with validation in between. I've seen many designs where the Service Layer is what holds a reference to the repositories (in essence skipping the "business layer"). In essence it serves the same purpose as my Business layer, it does the validation, however its' responsibility (and naming) is a higher level, more coarse grained business transaction. Using the example above the TradingService.submitTrade() will not delegate to any business manager classes, it would itself query the necessary repositories, perform all the validation etc.
I like my design in a sense that I can reuse a business layer method in multiple service calls, however I hate the fact that for every repository I have a matching business layer manager, creating tons of extra work. Maybe the solution is a different type of grouping at the Business Layer level? For example combine individual Manager classes like PhoneManager and EmailManager (note I have Phone entities and Email entities) into a logical Manager class such as ContactsManager (note I don't have a "Contact" entity type). With methods such as ContactManager.GetPhones() and ContactManager.GetEmail(), etc.
View 1 Replies
Jun 3, 2010
here i have in 3-tier architecture , how to pass the data between DAL and BAL. i am using grid view to edit the data,when ever i click on the edit button all the corresponding fields should come to textboxes. i tried for delete ,it works fine bt not working to EDIT.
View 7 Replies
Mar 30, 2011
I use a Detailsview, Entity Data Source to edit/update my table with only 3 columns.(it has primary keys).
Everything works fine inserts/edit in dev environment. but when i run this in release mode. i cannot update existing data in the database with the detailsview. whenever i update and save page gets refreshed, but nothing gets updated. but whenever i insert a new record, and then i try editing it. it works.?
Note: i handle DetailsviewItemUpdating,DetailsviewItemInserting events to do some custom checks.
View 1 Replies
Oct 25, 2010
Is there a way to export a EF 4.0 Data Model to EF 3.5?
I looked around and found that we are not able to access EF 4.0 from a ASP.Net 3.5 project here: [URL]
Our project is the 1st to go to .Net 4.0 using Entity Framework and we (the team) were wondering if there was a way for the other projects that "might" need to access our data that are still using the .Net 3.5 framework.
View 1 Replies
Jan 25, 2011
I want to update database using entity framework by passing class object in one go with setting without setting object values again.
I have added data using following code
[code]....
here obj is class object which i have passed to the AddTotblTables() method
similary i want to update table in same manner by passing class object.
View 1 Replies
Nov 3, 2010
how to change the database while using ADO.Net Entity Framework?
I have two identical databases. I want to change the db. Can i change it through web.Config?
Like LINQ to SQL ?
View 2 Replies
Nov 25, 2010
in my table test
Name Add
0 prinku sad
1 tommy asdsa
2 ghhgh sdsdd
now i want to select the name in the first row...am using Ado.net entity framework
empEntities db =
new
empEntities();
now how to select the name at 1
db.Tests.Name.ElementAt(1);?actuually this throws an error...
View 5 Replies
Sep 28, 2010
I'm wondering how can I use LINQ in here?
Code:
public Northwind.ProductsDataTable GetProducts()
{
[Can I use Linq here?]
return Adapter.GetProducts();
}
I followed the way of using Business Layer through this tutorial and I'm wondering how I can use LINQ there:
View 1 Replies
Feb 7, 2011
We have an IVR product that reads a configuration database for callflow information. I am writing a tool for our implementation team that will allow them to add/delete/update the data in the configuration database. Once the tool is in production, the implementer will use only the production release of the tool to modify the configuration database in all four of the IVR regions (Dev, QA, Cert, and Prod). Each region has its own database with identical schemas. The tool has 'tabs' across the top for each region. If a user is currently working in the Dev region and clicks the QA tab, how do I switch my connection from the Dev db server to the QA db server?
View 3 Replies
Nov 7, 2010
All I am trying to do is to make an update to an existing User and then save the changes to the database. I fooled around with different options and can see that I can make the change to the context during Page_Load, but it does not commit the changes to the Database.
View 5 Replies
Oct 1, 2010
I need to do a site similar to [URL] but don't know how to display or retrieve the images as in the above website.
View 3 Replies
Jan 27, 2011
I am implementing 3-tier architecture. I just wanted to know the role of business layer in 3-tier architecture.
I am developing application in using entity framework. So I have entity object which is accessiable in PL,BL & DL. My question is whether input assignment to entity object should be in PL OR BL.(Consider there is save method)
View 2 Replies
Sep 9, 2010
What is the best way (for a .Net 4 project) to implement authorization in the business layer. Simply I want to check whether a certain identity can access a certain action/resource.
I've tried to look this up in Patterns & Practices, but haven't found anything useful yet.
And what about PrincipalPermission of ASP.Net 2.0? Is this still relevant? What about maintenance?
I want to use an elegant solution, preferably (re)using asp.net role management.
View 2 Replies
Mar 7, 2011
I have a application with a 3-tier architecture. Onclick event of a button, I am calling a method in my code behind file. This method is defined in the Interface( Interface resides in my Business layer) and the implemtation of this method is given in the Data access layer.
The business layer and DAL are on different projects. I have compiled the entire solution and it complies OK. Now when I try to click the button I get the error:
"The method 'doInsertCust' was not found on the interface/type 'My.Type, MyTypeLibrary, Version=1.0.2371.15203, Culture=neutral, PublicKeyToken=null'.".
Note that I have already build the Business layer and DAL and the respective DLL gets automatically refreshed.
View 4 Replies
Aug 6, 2010
My application has a three tier architectute
UI Business DataAccess Here, I'm calling a SP from Data Access layer which will populate a DataTable and return the DataTable back to Business. My source code is like below.
[Code]....
Here, when I set debugpoint I can see the DataTable is getting populated by the data so my
sp idreturning the data. there is no issue with the sp and dataaccess layer method. The problem lies below on my business layer. The source code is like below.
[Code]....
View 2 Replies
Mar 7, 2011
I have a application with a 3-tier architecture. Onclick event of a button, I am calling a method in my code behind file. This method is defined in the Interface( Interface resides in my Business layer) and the implemtation of this method is given in the Data access layer.
The business layer and DAL are on different projects. I have compiled the entire solution and it complies OK. Now when I try to click the button I get the error:
"The method 'doInsertCust' was not found on the interface/type 'My.Type, MyTypeLibrary, Version=1.0.2371.15203, Culture=neutral, PublicKeyToken=null'.".
Note that I have already build the Business layer and DAL and the respective DLL gets automatically refreshed.
View 10 Replies
Dec 17, 2010
I am creating an ASP.NET MVC application and want to display an icon in the view based on a value of a property in the model. I guess I want to have the logic deciding which image to show in the business layer (which is in a separate class library project) but the actual images files in the web application's "Content" folder. Should I set the url of the image in the business layer? I don't want the business layer to know that is serves a web application, it can be a Windows Form or WPF application as well. If I set the url with System.Web.HttpContext.Current.Server.MapPath it feels like I am getting an unwanted dependency on System.Web, right? What are the options here?
View 1 Replies