data-access-layer

Correct way to use PetaPoco in DAL layer (ASP.NET Web Forms VB.NET)

一曲冷凌霜 提交于 2019-12-08 06:22:37
问题 I'm trying to generate my DAL layer for ASP.NET web forms project using PetaPoco. Namespace Eva.Dal.Polls Public Partial Class EVAMOD_PL_CategoryDb Private db As Eva.Dal.Core.EvaDb Public Function Insert(a As EVAMOD_PL_Category) As Object Return db.Insert(a) End Function Public Sub New() db = New Eva.Dal.Core.EvaDb End Sub End Class Public Partial Class EVAMOD_PL_GL_CategoryDb Private db As Eva.Dal.Core.EvaDb Public Function Insert(a As EVAMOD_PL_GL_Category) As Object Return db.Insert(a) End

Help with debate on Separation of concerns (Data Access vs Business Logic) [closed]

谁说胖子不能爱 提交于 2019-12-07 21:24:39
问题 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 5 years ago . I had a debate with my co-worker on whether certain logic belongs in the data access or business logic layer. The scenario is, the BLL needs some data to work with. That data primarily lives in the database. We want to cache that data (using System.Runtime.Caching) so it's

Should my persistence class return Option or rely on exceptions?

倾然丶 夕夏残阳落幕 提交于 2019-12-07 17:22:19
问题 My application's persistence layer is formed by a Storage trait and an implementing class. I'm vacillating on this issue: should the fetchFoo(key: Key) methods should return Option[Foo] , or should they throw FooNotFound exceptions if the key cannot be found? To add flavour to the issue, the persistence layer - it is written in Scala - is called by Java code. Dealing with scala.Option in Java code? Hmmm. In fact, until yesterday, the persistence layer was written in Java; I've just re-written

Removing Data Access layer coupling from user interface

风流意气都作罢 提交于 2019-12-07 09:46: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 { return _instance; } } // Methods } My BLL will look something like this: namespace YLA.Barcode { public

How to organize Data Access Layer (DAL) in ASP.NET

百般思念 提交于 2019-12-07 07:47:34
问题 I have an ASP.NET Web Forms application developed in C#. I would like to give structure my application by separating the DAL tasks from the code behind. I created a class in App_Code, DBUtilities that takes care of the communication with the database, in order not to have duplicated code all along the application. The class has methods to get datatables, scalar values, etc... and they accept as parameters the connection string name and the query command as string. The problem is that I have

Using DTOs and BOs

耗尽温柔 提交于 2019-12-07 07:32:51
问题 One area of question for me about DTOs/BOs is about when to pass/return the DTOs and when to pass/return the BOs. My gut reaction tells me to always map NHibernate to the DTOs, not BOs, and always pass/return the DTOs. Then whenever I needed to perform business logic, I would convert my DTO into a BO. The way I would do this is that my BO would have a have a constructor that takes a parameter that is the type of my interface (that defines the required fields/properties) that both my DTO and

Few things about Repository Pattern that I simply don't understand

送分小仙女□ 提交于 2019-12-07 02:47:51
问题 I've read quite a few topic on what Repository is, but there are still few things bugging me. To my understanding only difference between Repository and traditional data access layers are Repository's query construction capabilities ( ie Query Object pattern ). But when reading the following definitions of a Repository Pattern , it seems we can still have Repository even if we don't implement Query Object pattern : a) From: Repositories are the single point where we hand off and fetch objects

Help with debate on Separation of concerns (Data Access vs Business Logic) [closed]

允我心安 提交于 2019-12-06 11:04:41
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 5 years ago . I had a debate with my co-worker on whether certain logic belongs in the data access or business logic layer. The scenario is, the BLL needs some data to work with. That data primarily lives in the database. We want to cache that data (using System.Runtime.Caching) so it's quickly available on subsequent requests. The architecture is such that the DAL and the BLL live on the

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

不问归期 提交于 2019-12-06 07:54:05
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 class DinnersController : Controller { IDinnerRepository dinnerRepository; // // Dependency Injection

Should my persistence class return Option or rely on exceptions?

随声附和 提交于 2019-12-05 20:36:34
My application's persistence layer is formed by a Storage trait and an implementing class. I'm vacillating on this issue: should the fetchFoo(key: Key) methods should return Option[Foo] , or should they throw FooNotFound exceptions if the key cannot be found? To add flavour to the issue, the persistence layer - it is written in Scala - is called by Java code. Dealing with scala.Option in Java code? Hmmm. In fact, until yesterday, the persistence layer was written in Java; I've just re-written it in Scala. As a Java code base, it relied on exceptions rather than returning nulls; but now that I