Skip to content

How to use Unity instead of Ninject as IoC? #35

Description

@Rotte2

Hi

It's probaby not the right place for this question, but I would like to use MemFlex with RavenDB in a ASP.NET MVC 4 project of mine. I have not used Ninject as IoC before, and would like to ask, how these should be registered using Unity?

var kernel = new StandardKernel();
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
kernel.Bind<IApplicationEnvironment>().To<AspnetEnvironment>();
kernel.Bind<IFlexMembershipProvider<User>>().To<FlexMembershipProvider<User>>();
kernel.Bind<IFlexRoleProvider>().To<FlexRoleProvider>();
kernel.Bind<IFlexOAuthProvider<User>>().To<FlexMembershipProvider<User>>();
kernel.Bind<IFlexUserStore<User>>().To<FlexMembershipUserStore<User, Role>>();
kernel.Bind<IFlexRoleStore>().ToMethod(c => (IFlexRoleStore)c.Kernel.Get<IFlexUserStore<User>>());
RegisterServices(kernel);

/Michael

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions