Entity Framework provider

EntityFrameworkProvider extracts options from a DBSet related with the logged user DBSet. It has save and auto-create capabilities.

Its Prefix must be passed in the constructor, and it is Enabled only when the user is logged in.

Below the list of all provider specific properties:


        public Expression<Func<T, M>> UserOptionsExpression { get; set; }
        protected Func<T, M> UserOptions { get; set; }
        public Action<T, M> ApplyOptionsToUser { get; set; }
        public bool SaveDbContext { get; set; }
        public bool RelogUserAfterSave { get; set; }
        public bool PersistentSignIn { get; set; }
        public string AuthenticationMethod { get; set; }
        

With:

UserOptionsExpression
An expression that selects the application user obect(of type T) property that contains the object of type M whose properties must be added to the request dictionary. It is appled on the currently logged user object (as returned by the UserManager<T>) to get an object of type M containing all data to insert into the request dictionary. Each object public property creates an entry with the same name. If no such a property exists one may use the UserOptions function.
UserOptions
Generalization of UserOptionsExpression. A function that once invoked on the currently logged user object (as returned by the UserManager<T>) returns an object of type M containing all data to insert into the request dictionary. Each object public property creates an entry with the same name.
ApplyOptionsToUser
To be used when UserOptions is used instead of UserOptionsExpression, in order to save overwritten data in the source. It is needed for associating an object M to a specific user after it has been extracted from the request dictionary.
SaveDbContext
When set, the current db context is persisted to the database immediately after a save operation.
RelogUserAfterSave
When set, it forces current user re-login after having saved data. When RelogUserAfterSave is set the provider implicitely assume also SaveDbContext is set.
PersistentSignIn
Declares if persistent sign in must be used when re-logging after an user claims modification
AuthenticationMethod
Declares the authentication method name to use when re-logging after an user claims modification

Both PersistentSignIn and AuthenticationMethod are the standard parameters usually passed to the SignInAsync method of the SignInManager. See here for an introduction to authentication and SignInManager.


Fork me on GitHub