data-access-layer

What is a good approach for a Data Access Layer?

让人想犯罪 __ 提交于 2019-12-10 11:38:22
问题 Our software is a customized Human Resource Management System (HRMS) using ASP.NET with Oracle as the database and now we are actually moving to make it a product that supports multiple tenants with their own databases. Our options: Use NHibernate to support Multiple databases and use of OO. But we concern related to NHibernate learning curve and any problem we faced. Make a generalized DAL which will continue working with Oracle using stored procedures and use tools to convert it to other

whats the recommended Data access layer design pattern if i will apply ado entity frame work later?

孤者浪人 提交于 2019-12-10 10:37:17
问题 I am creating a website and using Linq to SQl as a data access layer, and i am willing to make the website can work on both linq to sql and ado entity framework, without changing many things in the other layers: business logic layer or UI layer, Whats the recommended pattern to achieve this goal? can you explain in brief how to do that? UPDATE As answered below that repository pattern will help me a lot, i checked nerd dinner website and understood it, but i found this code inside: public

Enterprise library caching parameters on stored procs?

谁说我不能喝 提交于 2019-12-10 10:04:20
问题 I'm trying to standardise some data access code with my colleagues. One of the aforementioned colleagues asserts that the EntLib Data Access Block trys to cache parameters on stored proc calls. I've had a look in reflector and there is some evidence that it could be caching them. But I don't think it does in the following situation. public Dictionary<long, string> GetQueue(int maxItems) { var sq = new SqlDatabase(_connString.ConnectionString); var result = new Dictionary<long, string>();

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

谁说胖子不能爱 提交于 2019-12-09 22:02:59
问题 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

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

删除回忆录丶 提交于 2019-12-09 16:40:46
问题 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

Communication between BLL and DAL

那年仲夏 提交于 2019-12-09 04:46:43
问题 Solution setup: DAL (class library) BLL (class library) Common (class library (some common functionality - enums, logging, exceptions,...)) Application1 (Windows Application) Application2 (Windows Application) WebApp (Web application) ... Let's say I have a Customer entity, which is: a table in SQL server a CustomerDataTable in DAL a Customer class in BLL a BLL.Customer class in all the applications What kind of objects should BLL and DAL use for communication - DataTable or List<Customer>

best practice for DAL and configuration on Multi-Tenant isolated DB

微笑、不失礼 提交于 2019-12-08 20:48:46
问题 My company holds a dozen websites and isolated DBs (identical schemas). every customer has its own website (different app pool) and DB. every website has its own configuration, several connection strings, but they all have same schema for configuration. cust1.domain.com cust2.domain.com cust3.domain.com We would like to merge all websites to one (single app pool) and stay with isolated DBs for security and large amount of data reasons. what is the best practice for designing a DAL and

Problem when trying to configure enterprise library 5.0 (Data Access Application Block)

允我心安 提交于 2019-12-08 14:59:49
问题 I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors... 1) Download / install enterprise library 2) Add references to the blocks I need (common / data) 3) Imports Imports Microsoft.Practices.EnterpriseLibrary.Common Imports Microsoft.Practices.EnterpriseLibrary.Data 4) Through the enterprise library config software. I open up the web.config from my site. I then click Blocks, then Add

C#: Services access the dataprovider class running the sql statements - correct approach?

白昼怎懂夜的黑 提交于 2019-12-08 11:46:02
问题 is this a common and/or good approach? In my ViewModel(Wpf) or Presenter(WinForms) I do this: ICustomerService customerService = MyService.GetService<ICustomerService>(); ICustomerList customerList = customerService.GetCustomers(); the CustomerService class looks like this: public class CustomerService : ICustomerService { public ICustomerList GetCustomers() { return _customerDataProvider.GetCustomers(); } } public class CustomerDataProvider() { public ICustomerList GetCustomers() { // Open

Removing Data Access layer coupling from user interface

五迷三道 提交于 2019-12-08 06:35:27
问题 Currently my application's UI layer is coupled to my DAL dll. Dal is initialized like this: //Initialize Data Access for AS400 Dal = JDE8Dal.Instance; Dal.conString = Properties.Settings.Default.conAS400; DAL is desinged as singleton. I thought that forcing the application to have one instance is a good idea. DAL: public class JDE8Dal { public string conString { get; set; } private static readonly JDE8Dal _instance = new JDE8Dal(); private JDE8Dal() { } public static JDE8Dal Instance { get {