Convert Database projects so they build installable Packages rather than deploy to bin and modify installation to deploy Databases on demand as needed.
This commit is contained in:
		| @ -1,6 +1,7 @@ | ||||
| using System; | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Oqtane.Databases.Interfaces; | ||||
| using Oqtane.Interfaces; | ||||
| // ReSharper disable ConvertToUsingDeclaration | ||||
|  | ||||
|  | ||||
| @ -101,26 +101,7 @@ namespace Microsoft.Extensions.DependencyInjection | ||||
|  | ||||
|                 if (!assemblies.Any(a => AssemblyName.ReferenceMatchesDefinition(assemblyName, a.GetName()))) | ||||
|                 { | ||||
|                     try | ||||
|                     { | ||||
|                         var pdb = Path.ChangeExtension(dll.FullName, ".pdb"); | ||||
|                         Assembly assembly = null; | ||||
|  | ||||
|                         // load assembly ( and symbols ) from stream to prevent locking files ( as long as dependencies are in /bin they will load as well ) | ||||
|                         if (File.Exists(pdb)) | ||||
|                         { | ||||
|                             assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(dll.FullName)), new MemoryStream(File.ReadAllBytes(pdb))); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(dll.FullName))); | ||||
|                         } | ||||
|                         Console.WriteLine($"Loaded : {assemblyName}"); | ||||
|                     } | ||||
|                     catch (Exception e) | ||||
|                     { | ||||
|                         Console.WriteLine($"Failed : {assemblyName}\n{e}"); | ||||
|                     } | ||||
|                     AssemblyLoadContext.Default.LoadOqtaneAssembly(dll, assemblyName); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Charles Nurse
					Charles Nurse