コード例 #1
0
 public DCDriverInfo(DataContextDriver driver)
 {
     this.Loader = driver.Loader;
     this.Name = driver.Name;
     this.Author = driver.Author;
     this.Version = driver.Version.ToString();
     this.IsAuto = driver is DynamicDataContextDriver;
 }
コード例 #2
0
 public Repository(XElement store)
 {
     this.AutoGenNamespace = "LINQPad.User";
     this.AutoGenTypeName = "TypedDataContext";
     this._linkedDbs = new List<LinkedDatabase>();
     this._driverLoader = DCDriverLoader.DefaultLoader;
     this.LoadFromStore(store);
 }
コード例 #3
0
 public DCDriverInfo(DataContextDriver driver)
 {
     this.Loader  = driver.Loader;
     this.Name    = driver.Name;
     this.Author  = driver.Author;
     this.Version = driver.Version.ToString();
     this.IsAuto  = driver is DynamicDataContextDriver;
 }
コード例 #4
0
 private Repository(SerializationInfo info, StreamingContext context)
 {
     this.AutoGenNamespace = "LINQPad.User";
     this.AutoGenTypeName = "TypedDataContext";
     this._linkedDbs = new List<LinkedDatabase>();
     this._driverLoader = DCDriverLoader.DefaultLoader;
     this.LoadFromStore(XElement.Parse(info.GetString("data")));
     this._sessionData = (Dictionary<string, object>) info.GetValue("sessionData", typeof(Dictionary<string, object>));
 }
コード例 #5
0
        public override bool Equals(object obj)
        {
            DCDriverLoader loader = obj as DCDriverLoader;

            if (loader == null)
            {
                return(false);
            }
            return(this.GetDescriptor() == loader.GetDescriptor());
        }
コード例 #6
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>());
        }
コード例 #7
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));
            }
        }
コード例 #8
0
 public void LoadFromStore(XElement store)
 {
     this._store = store;
     Guid? nullable = (Guid?) this._store.Element("ID");
     if (!nullable.HasValue)
     {
         this.ID = Guid.NewGuid();
     }
     string str = (string) this._store.Element("Password");
     if (!string.IsNullOrEmpty(str))
     {
         this._password = this.Decrypt(str);
     }
     this.AttachFileName = this.AttachFileName;
     XElement other = store.Element("DriverData");
     this.DriverData = (other == null) ? new XElement("DriverData") : new XElement(other);
     this._driverLoader = DCDriverLoader.FromXElement(store.Element("Driver"));
     this._linkedDbs = (from e in store.Elements("LinkedDb")
         select new LinkedDatabase((string) e.Attribute("Server"), e.Value) into e
         orderby e
         select e).ToList<LinkedDatabase>();
 }