dashing icon indicating copy to clipboard operation
dashing copied to clipboard

Entities without primary keys

Open jburditt opened this issue 9 years ago • 3 comments

If there is one or more entities without a primary key then the rest of the entities break on tracking:

Initialization method Dashing.Repository.Tests.CRUDTests.Test_Initialize threw exception. System.InvalidCastException: System.InvalidCastException: Unable to cast object of type 'Dashing.Model.Product' to type 'Dashing.CodeGeneration.ITrackedEntity'..

To reproduce add this class to TestDomain:

public class NoPrimary {
    public virtual string Name { get; set; }
}

jburditt avatar May 25 '16 15:05 jburditt

That does not surprise me in the slightest. Dashing makes a very definite assumption that you have a single column primary key defined on all tables.

What's your use case?

markjerz avatar May 25 '16 15:05 markjerz

I used a T4 template to build all of my POCOs from an existing database. To get the POCOs with primary keys to work; I will need to delete all POCOs without primary keys.

jburditt avatar May 26 '16 17:05 jburditt

What sort of tables are the ones without primary keys?

No idea on the effort involved but I could be persuaded to support tables without PKs if there are good reasons to do so.

markjerz avatar May 26 '16 17:05 markjerz