Я попытался зарегистрировать тип в контейнере, используя приведенный ниже скрипт, он работает хорошо
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
может ли кто-нибудь дать несколько предложений? большое спасибо