data-access-layer

Manual DAL & BLL vs. ORM

有些话、适合烂在心里 提交于 2019-12-02 21:24:30
Which approach is better: 1) to use a third-party ORM system or 2) manually write DAL and BLL code to work with the database? 1) In one of our projects, we decided using the DevExpress XPO ORM system, and we ran across lots of slight problems that wasted a lot of our time. Amd still from time to time we encounter problems and exceptions that come from this ORM, and we do not have full understanding and control of this "black box". 2) In another project, we decided to write the DAL and BLL from scratch. Although this implied writing boring code many, many times, but this approach proved to be

Presentation, Business and Data Layer

好久不见. 提交于 2019-12-02 21:13:22
I just started programming in C# and was reading about dividing your application / website into the three different layers was the best practice but I am having a hard time understanding exactly how. Im working on a pet project to lean more about C# but I dont want to start on any bad habits. Can you look at what I have and see if I am doing this right? Offer some hints suggestions as to how to break everything down to the different layers? Presentation Layer <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML

django models = business logic + data access? Or data access layer should be separated out from django model?

非 Y 不嫁゛ 提交于 2019-12-02 20:47:10
In Django, the suggested software architecture is to put all business logic and data access in models. But, some colleagues have suggested that the data access layer should be separate from the business logic (business service layer). Their justification is that the data access layer can isolate changes if a different data source is used. They also say that there is business logic that can be in more than one model. But, when I start coding using the separate data access and business logic layers, the data access layer is simple (basically the model code that defines the db schema) and it does

What to return from the DAL to BLL

╄→гoц情女王★ 提交于 2019-12-02 19:37:35
I currently have an application which consists of: User Interface (web page) BLL (Manager & Domain Objects) DAL (DataAccess class for each of my Domain Objects). I use the following in the UI to search for a domain object. protect sub Button1_Click() { IBook book = BookManager.GetBook(txtID.Text); } Here is my BLL public class BookManager { public static IBook GetBook(string bookId) { return BookDB.GetBook(bookId); } } public class Book : IBook { private int? _id private string _name; private string _genre; public string Name { get { return _name; } private set { if (string.IsNullOrEmpty(value

Where do you put SQL Statements in your c# projects?

会有一股神秘感。 提交于 2019-12-02 19:14:15
I will likely be responsible for porting a vb6 application to c#. This application is a windows app that interacts with an access db. The data access is encapsulated in basic business objects. One class for one table basically. The existing vb6 business objects read and write to the DB via DAO. I have written DALs and ORMs a few times before but they all targeted SQL Server only. This one will need to target access and sql server. In previous projects, I would place the SQL strings in the private parts of the business object and maybe move the redundant sql code like connecting, creating

Why put a DAO layer over a persistence layer (like JDO or Hibernate)

我是研究僧i 提交于 2019-12-02 17:05:26
Data Access Objects (DAOs) are a common design pattern, and recommended by Sun. But the earliest examples of Java DAOs interacted directly with relational databases -- they were, in essence, doing object-relational mapping (ORM). Nowadays, I see DAOs on top of mature ORM frameworks like JDO and Hibernate, and I wonder if that is really a good idea. I am developing a web service using JDO as the persistence layer, and am considering whether or not to introduce DAOs. I foresee a problem when dealing with a particular class which contains a map of other objects: public class Book { // Book

POCO's, DTO's, DLL's and Anaemic Domain Models

爱⌒轻易说出口 提交于 2019-12-02 15:38:42
I was looking at the differences between POCO and DTO (It appears that POCO's are dto's with behaviour (methods?))and came across this article by Martin Fowler on the anaemic domain model. Through lack of understanding, I think I have created one of these anaemic domain models. In one of my applications I have my business domain entities defined in a 'dto' dll. They have a lot of properties with getter's and setter's and not much else. My business logic code (populate, calculate) is in another 'bll' dll, and my data access code is in a 'dal' dll. 'Best practice' I thought. So typically I

Separate Read/Write Connection for SubSonic

纵饮孤独 提交于 2019-12-02 11:53:17
问题 The security policy at our client's production environment requires that we use separate connection to execute writes and read to and from database. We have decided to use SubSonic to generate our DAL. So I am interested in knowing if it is possible and if yes how? 回答1: You can specify the provider SubSonic is using at runtime. So you would specify the read provider (using your read connectionstring) when loading from the database and then specify the write provider (using your write

ASP.net DAL DatasSet and Table Adapter not in namespace - Northwind Tutorial

六月ゝ 毕业季﹏ 提交于 2019-12-02 11:47:25
问题 I've been attempting to walk through the "Creating a Data Access Layer" tutorial found http://www.asp.net/learn/data-access/tutorial-01-cs.aspx I create the DB connection, create the typed dataset and table adapter, specify the sql, etc. When I add the code to the presentation layer (in this case a page called AllProducts.aspx) I am unable to find the NorthwindTableAdapters.ProductsTableAdapter class. I tried to import the NorthwindTableAdapters namespace, but it is not showing up. Looking in

Entitity Framework 4.1 - Code First- Unit testing data access layer

大兔子大兔子 提交于 2019-12-02 08:01:31
I'm a .NET developer and I'm writing tests for my data access layer. I have tests that use fake repository - I have achieved that by using Moq and Ninject. I'm getting my head around EntityFramework 4.1 Code First model and I'd like to create a prototype for CRUD routines. It's an MVC app, so my entities won't be tracked by a context. To me it feels wrong that I'm writing tests that will make changes to the database. I will then have to clear the database each time I want to run these tests. Is this the only way to test CRUD routines? Thank you How do you expect to test data access if you don