data-access-layer

n-layered architecture - BLL, DAL and interfaces. What is best practice?

耗尽温柔 提交于 2019-12-04 16:33:20
I have a question regarding n-layer architecture. I thought long and hard before asking this question as there's a lot of similar questions here already... however, after literally a day and a half looking at it and reading these other answers I'm still unsure. The variety of seemingly similar terminology and different approaches has me confused. If I had a BLL and a DAL in different class libraries, one way to communicate between the BLL and DAL would be to utilise an interface, kind of like a DTO defined in another separate DLL that was referenced by both BLL and DAL. My domain model

Best designs for breaking down business logic and data layer when they seem to overlap? [closed]

喜你入骨 提交于 2019-12-04 13:55:04
问题 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 last year . I'm building a MVC web application (using the Spring MVC framework), and I'm a little stumped on the best way to design a particular area. The application has to interact with a series of web services which are not really all that greatly designed, and don't offer much

Improving the performance of an nHibernate Data Access Layer

a 夏天 提交于 2019-12-04 10:01:17
I am working on improving the performance of DataAccess Layer of an existing Asp.Net Web Application. The scenerios are. Its a web based application in Asp.Net. DataAccess layer is built using NHibernate 1.2 and exposed as WCF Service. The Entity class is marked with DataContract. Lazy loading is not used and because of the eager-fetching of the relations there is huge no of database objects are loaded in the memory. No of hits to the database is also high. For example I profiled the application using NHProfiler and there were about 50+ sql calls to load one of the Entity object using the

Data access architectures with Raven DB

∥☆過路亽.° 提交于 2019-12-04 09:16:16
问题 What data access architectures are available that I can use with Raven DB? Basically, I want to separate persistence via interfaces, so I don't expose underline storage to the upper layers. I.e. I don't want my domain to see IDocumentStore or IDocumentSession which are from Raven DB. I have implemented the generic repository pattern and that seems to work. However, I am not sure that is actually the correct approach. Maybe I shall go towards command-query segregation or something else? What

How to effectively Unit Test a DAL that uses ADO.NET and SQL Server with NUnit?

有些话、适合烂在心里 提交于 2019-12-04 08:05:40
So you have a DAL in C# that using the Repository pattern and you have an interface for each Repository. It is backed by ADO.NET, MS SQL Server, and Stored Procedure calls. This is great for stubbing/mocking out the repository where it is being used else where when doing unit tests, and I Love it! However, I would love to add some unit testing for the DAL itself. Preferably using Rhino Mocks with NUnit. However I am open to switching to MoQ if a solid case could be made that it can do something that Rhino can't in relation to this question. I would rather not have it talk to any DB during the

List of SQL Server errors that should be retried?

放肆的年华 提交于 2019-12-04 07:32:40
Is there a concise list of SQL Server stored procedure errors that make sense to automatically retry? Obviously, retrying a "login failed" error doesn't make sense, but retrying "timeout" does. I'm thinking it might be easier to specify which errors to retry than to specify which errors not to retry. So, besides "timeout" errors, what other errors would be good candidates for automatic retrying? Thanks! You should retry (re-run) the entire transaction, not just a single query/SP. As for the errors to retry, I've been using the following list: DeadlockVictim = 1205, SnapshotUpdateConflict =

In-memory DBMS's for unit testing

大兔子大兔子 提交于 2019-12-04 05:10:11
I am looking for satisfactory options for unit testing my .NET DAL classes; since they're DAL classes, they access the database directly using ADO.NET. Presently I use an instance of a MSSQL database for the testing, but was wondering what faster options there are---since unit tests need to run as quickly as possible, an in-memory solution would be ideal. I should also mention that I have tied myself to TSQL since I'm only ever going to be using a Microsoft platform. Given that you state: I should also mention that I have tied myself to TSQL since I'm only ever going to be using a Microsoft

Why is SQL Server not recognized, even though I've got a reference to DAL05.dll?

余生长醉 提交于 2019-12-04 04:56:07
问题 It seems that whenever I add anything to my project which uses code in my commonClass.vb file, I get errors about SQL Server not being recognized. I do have a reference to DAL05. SQL Server in the file shows it's not recognized, as does the DAL05.DataAccess imports: Do I need to add another reference? Another or a different Imports? Or what? As you can see, I am referencing DAL05, and it is not offered as a way for SQL Server to be recognized: UPDATE : A possibly significant factoid: A

ASP.Net Layered app - Share Entity Data Model amongst layers

杀马特。学长 韩版系。学妹 提交于 2019-12-04 04:07:45
问题 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

How do I use Dapper to get the return value of stored proc?

心已入冬 提交于 2019-12-04 04:06:39
I'm using Dapper in asp.net mvc 4 project .net f/w 4.6.1 using sql server 2016 express <packages> <package id="Dapper" version="1.50.2" targetFramework="net461" /> </packages> I have a stored proc which deletes from 2 tables which should be transactional ALTER PROCEDURE [dbo].[FeedbackDelete] @FeedbackID UNIQUEIDENTIFIER AS SET NOCOUNT OFF SET XACT_ABORT ON BEGIN TRANSACTION DELETE FROM dbo.Document WHERE FeedbackId = @FeedbackID IF(@@ERROR != 0) BEGIN ROLLBACK TRANSACTION RETURN 1 END DELETE FROM [dbo].[Feedback] WHERE [FeedbackID] = @FeedbackID IF(@@ERROR != 0 OR @@ROWCOUNT != 1) BEGIN