From 506ad1c793fcdad3032cc6402a64e56600efd04e Mon Sep 17 00:00:00 2001 From: Valdis Iljuconoks Date: Mon, 29 Feb 2016 02:06:06 +0200 Subject: [PATCH 1/2] Added assembly scanner exceptions --- .../Sync/DbLocalizationProviderInitializationModule.cs | 6 +++--- DbLocalizationProvider/Sync/TypeDiscoveryHelper.cs | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DbLocalizationProvider/Sync/DbLocalizationProviderInitializationModule.cs b/DbLocalizationProvider/Sync/DbLocalizationProviderInitializationModule.cs index 02a8945a..61866322 100644 --- a/DbLocalizationProvider/Sync/DbLocalizationProviderInitializationModule.cs +++ b/DbLocalizationProvider/Sync/DbLocalizationProviderInitializationModule.cs @@ -26,7 +26,7 @@ public void Initialize(InitializationEngine context) return; } - context.InitComplete += ContextOnInitComplete; + context.InitComplete += DiscoverAndRegister; _eventHandlerAttached = true; } @@ -38,10 +38,10 @@ public void ConfigureContainer(ServiceConfigurationContext context) public void Uninitialize(InitializationEngine context) { - context.InitComplete -= ContextOnInitComplete; + context.InitComplete -= DiscoverAndRegister; } - private void ContextOnInitComplete(object sender, EventArgs eventArgs) + private void DiscoverAndRegister(object sender, EventArgs eventArgs) { if (!ConfigurationContext.Current.DiscoverAndRegisterResources) { diff --git a/DbLocalizationProvider/Sync/TypeDiscoveryHelper.cs b/DbLocalizationProvider/Sync/TypeDiscoveryHelper.cs index 4d55ce54..19d490dd 100644 --- a/DbLocalizationProvider/Sync/TypeDiscoveryHelper.cs +++ b/DbLocalizationProvider/Sync/TypeDiscoveryHelper.cs @@ -152,7 +152,9 @@ private static string GetResourceValue(PropertyInfo pi, string defaultResourceVa private static IEnumerable GetAssemblies() { - return AppDomain.CurrentDomain.GetAssemblies(); + return AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.FullName.StartsWith("Microsoft") + || !a.FullName.StartsWith("System") + || !a.FullName.StartsWith("EPiServer")); } private static IEnumerable GetTypesChildOfInAssembly(Type type, Assembly assembly) From 24d25ee7930878529f330d2f5756ae13365a3338 Mon Sep 17 00:00:00 2001 From: Valdis Iljuconoks Date: Fri, 4 Mar 2016 14:27:08 +0200 Subject: [PATCH 2/2] Fixed issue with cached model metadata provider --- .../DataAnnotations/CachedLocalizedMetadataProvider.cs | 3 +++ DbLocalizationProvider/Properties/AssemblyInfo.cs | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DbLocalizationProvider/DataAnnotations/CachedLocalizedMetadataProvider.cs b/DbLocalizationProvider/DataAnnotations/CachedLocalizedMetadataProvider.cs index 1e15178e..677d7ec1 100644 --- a/DbLocalizationProvider/DataAnnotations/CachedLocalizedMetadataProvider.cs +++ b/DbLocalizationProvider/DataAnnotations/CachedLocalizedMetadataProvider.cs @@ -21,6 +21,9 @@ protected override CachedDataAnnotationsModelMetadata CreateMetadataFromPrototyp metadataFromPrototype.AdditionalValues.Add(keyValuePair.Key, keyValuePair.Value); } + // we need to preserve DisplayName fetched during prototype creation + metadataFromPrototype.DisplayName = prototype.DisplayName; + return metadataFromPrototype; } diff --git a/DbLocalizationProvider/Properties/AssemblyInfo.cs b/DbLocalizationProvider/Properties/AssemblyInfo.cs index 9e41f3ab..6fa37cdc 100644 --- a/DbLocalizationProvider/Properties/AssemblyInfo.cs +++ b/DbLocalizationProvider/Properties/AssemblyInfo.cs @@ -5,9 +5,9 @@ [assembly: AssemblyTitle("DbLocalizationProvider")] [assembly: AssemblyDescription("Database driven localization provider for EPiServer")] [assembly: Guid("17ca5d23-46c3-44b1-8fa6-0f40b2e447ba")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyInformationalVersion("1.1.0")] [assembly: InternalsVisibleTo("DbLocalizationProvider.AdminUI")] [assembly: InternalsVisibleTo("DbLocalizationProvider.MigrationTool")] [assembly: InternalsVisibleTo("DbLocalizationProvider.Tests")]