.NET ORM for a database without defined primary keys

Does anyone know of an ORM tool for .Net that will work on a database without defined primary keys? By the way, we are running MS SQL Server 2005.

I cannot change the DB schema and add primary keys - DB is our ERP system and their business logic knows what will make the table insensitive.

For example, for the Customer table, it would have a primary key in the CustomerNumber field. SQL Server 2005 does not have a primary key in the Customer table, but the ERP software does not allow anyone to add two customers with the same CustomerNumber. So if I go directly to the database, I can add two customers with the same CustomerNumber, but going through our ERP software to be prevented.

I have used LINQ-SQL with success. I can define primary keys in designer in VS2008 and take full advantage of LINQ-SQL. However, I am about to start a big project and am looking for a more mature ORM tool. I've checked LLBL Gen Pro but can't get it to work. I also checked MS Entity Framework and ran into difficulties.

Any ideas or someone managed something similar to what I'm hoping to do?

+2


source to share


1 answer


I think you have already identified the key that you need, perhaps without realizing it.

Your database has primary keys, they just aren't enforced by the database engine.

For example, your table Customer

has a field CustomerNumber

, etc.



Any .NET ORM (I'm using NHibernate ) can do a great job of reading and updating.

Create and delete is the time that may arise.

For Create, you need to create new valid CustomerNumber values; and for deletion, you need to make sure you don't break any foreign key relationship. (In NHibernate, you can use the primary key type assigned

, which basically means your code will assign key values, and NHibernate must use them.)

+3


source







All Articles