This project is read-only.

Need some documentation for the 2.0.0-beta related to Owin

Jan 24, 2014 at 1:45 PM
I get lot of compiltation error on my 2.0.0-alpha code as for
            app.Use(typeof(IdentityFactoryMiddleware<DbContext, IdentityFactoryOptions<DbContext>>),
                new IdentityFactoryOptions<DbContext>()
                    Provider = new IdentityFactoryProvider<DbContext>()
                        OnCreate = (options) => createCallback()
Error 1 Delegate 'System.Func<Microsoft.AspNet.Identity.Owin.IdentityFactoryOptions<System.Data.Entity.DbContext>,Microsoft.Owin.IOwinContext,System.Data.Entity.DbContext>' does not take 1 arguments E:\WebAPI\DatwendoManager\ConnectorManagerRole\Extensions\OwinExtensions.cs 31 36 ConnectorManagerRole
Jan 27, 2014 at 11:04 PM
Mar 10, 2014 at 9:30 PM
Can you please post what you had to change this code to?
i am struggling with the same chunk of code, and don't understand what @suhasbj is telling me in the comment you referenced.

Mar 10, 2014 at 9:41 PM
Edited Mar 10, 2014 at 9:42 PM
I have totally rewritten my code several time since this question including autofac, so I don't totally remember the steps.

Now I have someting as
        // Configure the UserManager
        public static MyUserManager Create(IdentityFactoryOptions<MyUserManager> options,IOwinContext oContext)
            var manager                         = new MyUserManager(new CustomUserStore(oContext.Get<ConnectorDbContext>()));
            manager.UserValidator               = new UserValidator<MyUser, int>(manager)
                AllowOnlyAlphanumericUserNames  = false,
                RequireUniqueEmail              = false // true
            manager.PasswordValidator           = new MinimumLengthValidator(6);
            var dataProtectionProvider          = options.DataProtectionProvider;
            if (dataProtectionProvider != null)
                manager.UserTokenProvider       = new DataProtectorTokenProvider<MyUser,int>(dataProtectionProvider.Create("ASP.NET Identity"));

            return manager;
Hope it could help this desert of informations :)
Mar 10, 2014 at 10:03 PM
Thanks, that seems to have done the trick....not sure yet since i can't build due to one additional error.....maybe you have an idea?

I copied from the Sample that changes the PK to int.....and this function is complaining.
 public static IAppBuilder UseDbContextFactory(this IAppBuilder app, Func<DbContext> createCallback)
            if (app == null)
                throw new ArgumentNullException("app");
            if (createCallback == null)
                throw new ArgumentNullException("createCallback");

                typeof(IdentityFactoryMiddleware<DbContext, IdentityFactoryOptions<DbContext>>),
                new IdentityFactoryOptions<DbContext>()
                        Provider = new IdentityFactoryProvider<DbContext>(){ OnCreate = (options) => createCallback() }
            return app;
The error msg is:
Delegate 'System.Func<Microsoft.AspNet.Identity.Owin.IdentityFactoryOptions<System.Data.Entity.DbContext>,Microsoft.Owin.IOwinContext,System.Data.Entity.DbContext>' does not take 1 arguments  
I am still pretty new to this, so i am not really sure what the syntax is hard to figure out what to change.

Thanks again for your help so far!
Mar 10, 2014 at 10:24 PM
I am not sure you need this code now.
Try removing it.