Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entities without primary keys #3

Open
jburditt opened this issue May 25, 2016 · 3 comments
Open

Entities without primary keys #3

jburditt opened this issue May 25, 2016 · 3 comments

Comments

@jburditt
Copy link

jburditt commented May 25, 2016

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; }
}
@markjerz
Copy link
Contributor

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?

@jburditt
Copy link
Author

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.

@markjerz
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants