Custom membership provider or role my own implementation

I started using the membership provider on a new asp.net mvc project. My membership model is completely different from the default, but I assumed I could customize it to my liking. These are seams, although I am creating a custom implementation for everything I do.

My model has two types (inheriting from the same base) user objects and a Customer object.

public class Customer
{
    /* properties go here */

    // users linked with this customer
    public virtual IList<TypeOneUser> TypeOneUsers { get; set; }
    public virtual IList<TypeTwoUser> TypeTwoUsers { get; set; }
}

public abstract class User
{
    /* user properties go here */
}

public class TypeOneUser: User
{
    public virtual IList<Customer> Customers { get; set; }
}

public class TypeTwoUser: User
{
    public virtual Customer Customer { get; set; }
}

      

I am currently considering implementing the client repository and user repository and disposing of the membership provider. So my question is, is there a direct way to implement my membership model with a membership provider? At the moment I have User classes that are mostly implemented with a custom membership provider, but I'm not sure how to integrate the Customer object with the membership provider.

Also I am using Fluent Nhibernate, so I write my persistence code regardless of my approach.

+3


source to share


1 answer


You can see my blog post on creating a custom membership provider . There is an example in there, it uses Linq-to-Sql, but I think it can give you a pretty good idea of ​​how you can use your model to persist data to the database.



+2


source







All Articles