以下のスクリプトを使用してコンテナにタイプを登録しようとしましたが、うまく機能します
Container.RegisterType<System.Data.Objects.ObjectContext,
ExSS.Repository.MyEntity>( "myentity", new InjectionConstructor());
ただし、xml構成を使用しようとすると:
<alias alias="ObjectContext"
type="System.Data.Objects.ObjectContext,System.Data.Entity" />
<alias alias="MyEntity" type="ExSS.Repository.MyEntity,ExSS.Repository"/>
<register type="ExSS.Repository.MyEntity,ExSS.Repository" mapTo="MyEntity"
name="myentity">
<constructor></constructor>
</register>
それは動作しません。エラーメッセージは次のとおりです。
The type name or alias ObjectContext could not be resolved. Please check your
configuration file and verify this type name.
説明:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error
and where it originated in the code.
例外の詳細:
System.InvalidOperationException: The type name or alias ObjectContext could
not be resolved. Please check your configuration file and verify this type name.
スタック トレースは次のとおりです。
[InvalidOperationException: The type name or alias ObjectContext could not be resolved. Please check your configuration file and verify this type name.]
Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveType(String typeNameOrAlias, Boolean throwIfResolveFails) +200
Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolver.ResolveType(String typeNameOrAlias) +59
Microsoft.Practices.Unity.Configuration.RegisterElement.GetRegisteringType() +70
Microsoft.Practices.Unity.Configuration.RegisterElement.ConfigureContainer(IUnityContainer container) +111
Microsoft.Practices.Unity.Configuration.ContainerConfiguringElement.ConfigureContainerInternal(IUnityContainer container) +39
Microsoft.Practices.Unity.Configuration.<>c__DisplayClass1.<ConfigureContainer>b__0(ContainerConfiguringElement element) +42
Microsoft.Practices.ObjectBuilder2.EnumerableExtensions.ForEach(IEnumerable`1 sequence, Action`1 action) +200
Microsoft.Practices.Unity.Configuration.ContainerElement.ConfigureContainer(IUnityContainer container) +269
Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.Configure(IUnityContainer container, String configuredContainerName) +133
Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(IUnityContainer container, UnityConfigurationSection section, String containerName) +70
誰かがいくつかの提案をすることができますか? どうもありがとう