2016-03-26 8 views
1

以下の登録コードは構造マップです。ユニタリーコンテナ - Idataprotectorの登録

For<IDataProtector>().Use(() => new DpapiDataProtectionProvider().Create("ASP.NET Identity")); 

これと同等の登録は何ですか?

次のように試してみるとエラーになります。

container.RegisterType<IDataProtector>(() => new DpapiDataProtectionProvider().Create("ASP.NET Identity")); 

答えて

1
container.RegisterType<IDataProtector>(new InjectionFactory(c => new DpapiDataProtectionProvider().Create("ASP.NET Identity"))); 
関連する問題