Unity is configured conifg start-up project depend on the injection times wrong, the error message (error message below) is unable to parse the DLL file,
InvalidOperationException: The type name or alias Database. LinqDB, The Database could not be resolved. Both Please check your configuration file and verify this type name.
At first I thought that was written by a configuration file has a problem, but I found that as long as it is in the process of the test again reference projects generate DLL can run normally, once the cancellation reference error,
Then I passed a try, found in the Assembly to load a File can also be normal, but the use of the Assembly. The load (the File. The ReadAllBytes ()) :...
Excuse me everybody, this is precisely where there is a problem? DLL to ensure every time copy to the Debug directory, file must be exist is not parsing,
ExeConfigurationFileMap fileMap=new ExeConfigurationFileMap ();
FileMap. ExeConfigFilename=Path.Com bine (AppDomain. CurrentDomain. BaseDirectory + "DatabaseConfig. XML");//to find the path of the configuration file
Var configuration=ConfigurationManager. OpenMappedExeConfiguration (fileMap ConfigurationUserLevel. None).
UnityConfigurationSection section=(UnityConfigurationSection) configuration. GetSection (UnityConfigurationSection. SectionName);
_iUnityContainer=new UnityContainer ();
Foreach (var container in section. Containers)
{
_iUnityContainer. LoadConfiguration (section, container. Name);
}
This code is to load the configuration file, an error is in _iUnityContainer LoadConfiguration (section, the container Name); Here is a problem with the loading,
The above is configuration register files,