Example #1
0
        private DCDriverInfo[] GetDriversInAssemblyInternal(Assembly assem)
        {
            string name    = assem.GetName().Name;
            string pkToken = DCDriverLoader.GetPublicKeyToken(assem.GetName());

            return((from t in assem.GetExportedTypes()
                    where !t.IsAbstract && typeof(DataContextDriver).IsAssignableFrom(t)
                    let driver = InstantiateDCDriver(t)
                                 let loader = new DCDriverLoader(name, pkToken, t.FullName)
                                              select new DCDriverInfo {
                Loader = loader, Name = driver.Name, Author = driver.Author, Version = driver.Version.ToString(), IsAuto = driver is DynamicDataContextDriver
            }).ToArray <DCDriverInfo>());
        }
Example #2
0
        private void ProbeAssembly(string targetFile, string pkToken)
        {
            Assembly assem          = Assembly.LoadFrom(targetFile);
            string   publicKeyToken = DCDriverLoader.GetPublicKeyToken(assem.GetName());

            if (publicKeyToken.Length == 0)
            {
                Log.Write("Error loading driver '" + targetFile + "' - assembly is not strongly named.");
            }
            else if (pkToken.ToLowerInvariant() != publicKeyToken.ToLowerInvariant())
            {
                Log.Write("Error loading driver '" + targetFile + "' - bad directory name. Directory should be named: '" + Path.GetFileNameWithoutExtension(targetFile) + " (" + publicKeyToken + ")'");
            }
            else
            {
                this._drivers.AddRange(this.GetDriversInAssemblyInternal(assem));
            }
        }