Hi,
I inspect the IOCResolver value with my ILocalizationManager and I saw this exception:
'((System.RuntimeType) ((Abp.Localization.Sources.Resource.ResourceFileLocalizationSource) new System.Collections.Generic.Mscorlib_DictionaryDebugView<string, Abp.Localization.Sources.ILocalizationSource> (((Abp.Localization.LocalizationManager)_localizationManager)._sources) .Items[3].Value).ResourceManager.ResourceSetType).GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'
But I don't understand it.
I try to move the .resx files to Core project and add this on my Core module in PreInitialize:
Configuration.Localization.Sources.Add(
new ResourceFileLocalizationSource(
B2PeerConsts.LocalizationSourceName,
Localization.B2Peer.B2Peer.ResourceManager
)
);
And now LocalizationManager contains the 3 sources but it doesn't found my key. But I verify and the key is well present in .resx file.
What do you mean by make resouce XmlEmbedded ? I use a .resx files generate by Visual Studio with a .designer.cs class.
Yes, that's it. My module was not depending on AutoMapperModule so added it make it works.
Now I'm still blocked with another dependency error :(:
Can not find a source with name: EntrepriseNotFound
I use the ILocalizationManager to get my localized string but the injected LocalizationManager doesn't have my source because it is configured on AbpWebModule and not at Application level:
[DependsOn(typeof(B2PeerDataModule), typeof(B2PeerApplicationModule), typeof(B2PeerWebApiModule))]
public class B2PeerWebModule : AbpModule
{
public override void PreInitialize()
{
Configuration.Localization.Sources.Add(
new ResourceFileLocalizationSource(
B2PeerConsts.LocalizationSourceName,
Localization.B2Peer.B2Peer.ResourceManager
)
);
...
}
....
I try to resolve an instance with this source and LocalizationConfiguration have the 3 sources wanted (Abp, AbpZero and B2Peer) but LocalizationManager still have the only 2 (Abp and AbpZero)
protected B2PeerTestBase()
{
...
LocalIocManager.IocContainer.Register(
Component.For<ILocalizationConfiguration>()
.Instance(LocalizationConfiguration())
.IsDefault()
.Named("OverridingLocalizationConfiguration"));
LocalIocManager.IocContainer.Register(
Component.For<ILocalizationManager>()
.Instance(LocalizationManager())
.IsDefault()
.Named("OverridingLocalizationManager"));
}
private ILocalizationManager LocalizationManager()
{
return Resolve<ILocalizationManager>();
}
private ILocalizationConfiguration LocalizationConfiguration()
{
var configuration = Resolve<ILocalizationConfiguration>();
configuration.Sources.Add(
new ResourceFileLocalizationSource(
B2PeerConsts.LocalizationSourceName,
Web.Localization.B2Peer.B2Peer.ResourceManager
)
);
return configuration;
}
Is there an easy way to define ILocalizationManager to use my source in my TestBase ?
I don't want to test the translation and don't care if event it returns the sourceKey.
Hi,
I'm interesting to put authentication into a ASP.NET boilerplate with Angular SPA too.
Did you have some experiences to share or code to share?
Kind regards,
Jérôme