data-access-layer

Presentation, Business and Data Layer

痴心易碎 提交于 2019-12-20 10:11:05
问题 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#"

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

浪子不回头ぞ 提交于 2019-12-20 09:05:11
问题 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

ASP.NET and Entity Framework in Layered Architecture - using Entity Framework for ORM only

倖福魔咒の 提交于 2019-12-20 08:10:27
问题 I have an ASP.NET application that uses a layered architecture e.g. presentation layer, business logic layer, data access layer. I don't want to the business layer to have to know anything about how the data access layer is implemented and I'm not looking to bind the Entity's directly to a data control using the EntityDataSource or anything like that. (so a repository pattern scenario) I'M JUST LOOKING TO USE THE ENTITY FRAMEWORK AS AN ORM TOOL TO GENERATE CLASSES. I know how to do this. What

NHibernate: At what scope I should use transaction?

房东的猫 提交于 2019-12-20 06:48:46
问题 I am developing Data Access Layer using NHibernate. It will be used in my Business Logic Layer. My application is collection of multiple other applications (ASP.NET MVC, Windows Services, Windows Forms, ASP.NET Web API) those all will use same Business Logic Layer. Business Logic Layer will access Data Access Layer. Applications will NOT access Data Access Layer directly. I am aware that I should NOT depend on implicit transaction and should include all database calls (including READ calls)

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

回眸只為那壹抹淺笑 提交于 2019-12-20 06:37:38
问题 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.

How to organize DAL in ASP.NET MVC [closed]

☆樱花仙子☆ 提交于 2019-12-20 01:14:21
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I am trying to organize data access layer in asp.net mvc project. I've read a lot different articles about this, so still I have some questions in order to finish with this problem: Should I create instances of repository for every entity in database or for all or one

Data access layer design in DDD

不羁的心 提交于 2019-12-19 21:51:24
问题 Excuse me for my poor English. Ok, I'm thinking about DDD approach now and it sounds great but... There is one little question about it. DDD says that the domain model layer is totally decoupled from the data access layer (and all other layers). So when the DAL will save some business object it will have access to public properties of this object only. Now the question: How can we guarantee (in general) that a set of public data of an object is all we need to restore the object later? Example

What is DTO equivalent term for objects returned from DAL?

Deadly 提交于 2019-12-19 11:01:37
问题 I'm already using DTO's for data transfer over a network. Now I'm also introducing different DTO-like classes to the DAL. This is to avoid passing the application (business) objects across layers. To avoid naming confusion, I would like to use another term than DTO but can't find a good one. What is DTO equivalent term for objects returned from DAL? 回答1: "What's in a name? that which we call a rose by any other name would smell as sweet." - William Shakespeare Also, what Martin Fowler says

What is DTO equivalent term for objects returned from DAL?

会有一股神秘感。 提交于 2019-12-19 11:01:29
问题 I'm already using DTO's for data transfer over a network. Now I'm also introducing different DTO-like classes to the DAL. This is to avoid passing the application (business) objects across layers. To avoid naming confusion, I would like to use another term than DTO but can't find a good one. What is DTO equivalent term for objects returned from DAL? 回答1: "What's in a name? that which we call a rose by any other name would smell as sweet." - William Shakespeare Also, what Martin Fowler says

No context type was found in the assembly

不羁的心 提交于 2019-12-18 12:47:28
问题 I'm using .NET 4.0, MVC3, and EF5 with code first. My solution is split up into three projects, with the dependencies as indicated: Project.Web -> Project.BLL -> Project.DAL The Project.DAL layer contains my entity framework data context class and all my entities, but my startup project is Project.Web, so it contains my Web.config, connection strings, and the actual SQL compact database. I'm trying to enable migrations so I can add a new table to my EF model without wiping the existing data.