views:

65

answers:

1

I am about to start a project using NHibernate and Script#

NHibernate required that all properties be virtual, so I have my entity like this:

public partial class User
{
    public virtual string Username { get; set; }
    public virtual string PasswordHash { get; set; }

    public virtual DateTime DateRegistered { get; set; }
}

But Script# build fails when it encountered partial and virtual.
Partial I can cope with but not having virtual will probably requires a redesign/thinking ahead.

My goal is to share code between the main models project and the front-end Script# project so I don't have to re-implement the model twice, have strong-typing support and refactoring support throughout the models and scripts etc. etc.

Is this possible? Has anyone done this before? What are some available options?

A: 

I would create a ViewModel, and use AutoMapper to perform mapping for you, then you can use Script# with ViewModel.

epitka