data-access-layer

Why to avoid dynamic SQL queries ? any suggestion to remove there bad part and to use these?

左心房为你撑大大i 提交于 2019-12-23 15:44:03
问题 Can you please guide me why dynamic SQL is suggested to avoid ? Is there any way that I can keep on using dynamic SQL and avoid its bad things ? 回答1: http://www.sommarskog.se/dynamic_sql.html If you don't understand everything in this, come back and ask a question, but under no circustances should you use dynamic SQl until you understand this article. 回答2: The main problem is sql injection. People can enter data that can change the intent of your sql. One of the best solutions is to use sp

using nHibernate with multi DB instances with DI

筅森魡賤 提交于 2019-12-23 05:16:30
问题 So I have multi db instances and One web application. depending on the url name, I know what db instance I need to talk to. I want to change the old ugly DAL to work with nhibernate and I want to use DI to do that. so, let say I have this class: class CompanyDal(ISession session) //nhibernate session { Save(ICompany company) { session.Save(company) } } so I am injecting the hibernate session when creating the DAL object. but my IOC needs to know which session to inject, meaning which

web2py representation 'format' in grandchild

时光总嘲笑我的痴心妄想 提交于 2019-12-23 02:16:55
问题 The q&a here (and the doc) describe the use of the format= argument to the define_table function. I have a problem getting that to work in a slightly more complicated case. I'm using web2py version (1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable') , and Python 2.5.4 . (I'm using MySQL, but I assume that's irrelevant.) I have the following: 'Independent' (not a child) tables Institution and Person . Table Team is a child of Institution . Table Team_staff connects Person and Team

BLL,DAL,BO,inserting data

隐身守侯 提交于 2019-12-22 09:08:06
问题 I need your advice. I am trying to develop a 3 layer architecture in ASP.NET that separates BBL,DAL,BOboj. Inside the DAL, I collect the data via _view. What I wonder, should I write another BOboj for every view??I have already has a BOboj class but it doesn't contain all fields. When inserting data, I have to use my BOboj,however, when listing, should I create BOboj_view class or another something ?? inserting data (My colum only contains those values) BOboj { private int _PId; private

Transactions in “dapper-dot-net”

我只是一个虾纸丫 提交于 2019-12-22 06:56:01
问题 How do I create a transaction if my DAL is using dapper-dot-net? My c# winform application will be used in network and the data will be saved to a central sql server. My use case requires use of transactions. Can I do this using dapper, or will I need to use something like NHibernate? Also, is there any risk or limitation with this framework if I am using stored procedures? Will I need to change my approach due any possible limitations? 回答1: I haven't run into any limitations with using

Using interfaces for writing DAO classes

我的未来我决定 提交于 2019-12-21 17:54:12
问题 I'm creating a new web application which will use a bunch of Data Access Object(DAO) classes for doing CRUD operations on the data. I know I should write java interfaces when I have external users/applications using my DAO classes. But if there is no such need do you think I should still write the interfaces? I'll be injecting DAO classes in to the Spring Controller(I'm using Spring MVC) classes using spring. 回答1: NOTE THAT : You should always try to separating the Interface from the

List of SQL Server errors that should be retried?

僤鯓⒐⒋嵵緔 提交于 2019-12-21 16:57:03
问题 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! 回答1: You should retry (re-run) the entire transaction, not just a single query/SP. As for

In-memory DBMS's for unit testing

喜夏-厌秋 提交于 2019-12-21 12:26:22
问题 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. 回答1: Given that you state

Flat File Database Example

和自甴很熟 提交于 2019-12-21 12:23:36
问题 I would like to see some examples of simple flat file databases and how they are accessed through a data layer. I've written to and read from a flat file before, but I have not ever created a data layer that accessed the data for an application using text files. If possible, it would be nice to see a tutorial that had a data layer that utilized a simple, custom flat file database. An example that saves custom business objects in XML and then uploads them would be nice because XML is so

What is the difference between DAL, DTO and DAO in a 3 tier architecture style including with MVC

可紊 提交于 2019-12-20 11:59:20
问题 Recently I was learning about ORM (Object Relational Mapping) and the 3 tier architecture style (presentation,business and data persistence ). If I understand correctly, I can separate the data persistence layer into DTO and DAO layer. I would like to understand, how the following parts works together in a data persistence layer. DAL (Data Access Layer) DTO (Data Transfer Object) DAO (Data Access Object) In a top of that I learnt that In larger applications MVC is the presentation tier only