I am thinking about using transactions in 2-tier WPF (or windows forms) applications in following way:
We can begin new transaction when we open new form for editing data, edit and persist changes transparently in this transaction. Then we can click "OK" button and commit transaction, or "Cancel" button and rollback it. If we want to op...
We're going to be rebuilding one of our sites in .Net. I've read many articles and really like the idea of separating our project into a data access layer (DAL), Business logic layer (BLL), and presentation layer (we're coming from classic ASP so this is a massive step for us). I also really like Linq to SQL.
Since Linq to SQL is aimed...
Hi all,
I was just wondering about the correct way to return a reader from a class?
My code below works, but I'm unsure if this is correct.
Also. I can't close the the connection in my class method and still access it from my ascx page, is
that OK?
// In my class I have the following method to return the record/reader -- it's a si...
Hi,
I was just wondering how long should a DataContext really live. All the patterns and practices books like Dino Esposito's Microsoft .NET: Architecting Applications for the Enterprise tell you, datacontext must not live long, nor should it be cached. But how long is the right time? A whole web request, a unit of work, a transaction, ...
We recently added auditing to our database. A colleague implemented it using triggers and asked me to call a stored procedure on login to the website. The stored procedure inserts the current username, and the current oracle session id in a table so that the trigger could map a session id to a username. Problem is (or was) that he was as...
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 o...
I am not sure where the best location to handle my exceptions in my DAL class. I have some code that does a read, and populates a list of business objects like the pseudo-code below:
public List<MyObject> GetMyObjects()
{
while (dataReader.Read()
{
try
{
//populate business object
}
cat...
Hi!
I read the Book NHibernate in Action and there it is speaking about testing the persistence layer/data abstraction layer. You can test two ways. The mapping-test and the persistence logic-test. Accoring to the book testing the mapping means that entities are correctly loaded and saved.
But what's about update's and delete's?
By no...
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 ...
I would like to use entity framework in my asp.net application. I am new to entity framework.
I can use Linq to entities in any layer, but i would like to know best way where should i put Entity Framework? (DAL, BAL or direct use in Presentation). Any help would be appreciated.
...
Are there any DAL generators or ORMs that will work on .NET 1.1 with SQL CE 3.1?
This is only for a short lived project, so cost would be an issue
...
I'm currently using NetTiers for all data access operations. While it is easy to use, it is a major pain to deal with template updates and regenerating DAL especially on large and constantly evolving projects. Aside from that, NetTiers is database-centric, not model-centric which is where i'd like to be. What i would like to do is try ou...
I have a data access API that say looks something like:
public interface IDataAccess {
void save(Doc doc);
Doc retrieve(DocId id);
void delete(Doc doc);
}
I need to restrict the operations a user can perform on a document based upon their permissions. The idea I had to do this was to create another API that mirrored the data ...
I've read several other questions on this topic (here, here, and here), but have yet to see a great answer. I've developed my fair share of data access layers before and personally prefer to use instance classes instead of static classes. However, it is more of a personal preference (I like to test my business objects, and this approach ...
I know this is a very basic question. But I am really not able to comprehend what should we have in BLL.
Let me take an example.
Let us consider a Login.aspx web page, which is used to facilitate user login.
In this case Login.aspx will have two textboxes and one login button.(Presentation Layer).
Data Acess Layer will have functions to...
I am using web2py to power my web site. I decided to use the web2py DAL for a long running program that runs behind the site.
This program does not seem to update its data or the database (sometimes).
from gluon.sql import *
from gluon.sql import SQLDB
from locdb import *
# contains
# db = SQLDB("mysql://user/pw@localhost/mydb", pool...
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 learni...
I have a WPF application that uses LINQ-to-SQL on a local .MDF file. This solution is simple, easy, and effective, i.e. I set up my model once, then read/write data anywhere via LINQ:
using (var db = Datasource.GetContext())
{
oldItem = (from i in db.Infos
where i.Id == TheId
...
I am a newbie with Subsonic. I want to create a SQL connection using DSN; then I want to generate the DAL using Subsonic. Please can you give me some pointers on what to do?
...
I'm new to Moq, and just started on a project that's already in development. I'm responsible for setting up unit testing. There's a custom class for the DatabaseFactory that uses EnterpriseLibrary and looks like this:
public Database CreateCommonDatabase()
{
return CreateDatabaseInstance(string.Empty);
}
private static Database Creat...