Beispiel #1
0
 public override void InitAdapter(DbAdapter adapter)
 {
     dbadapter = adapter;
     if (adapter != null)
     {
         dbadapter.Init(connectionstring);
     }
 }
Beispiel #2
0
 abstract public void InitAdapter(DbAdapter adapter);
        public override void LoadFromCassettesExpress(IEnumerable <string> fogfilearr, Action <string> turlog, Action <string> convertlog)
        {
            foreach (string filename in fogfilearr)
            {
                XElement fog = XElement.Load(filename);
                totalelements += fog.Elements().Count();
                XDocument  xdoc = new XDocument();
                XElement   fog2 = new XElement(XName.Get("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
                XNamespace r    = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
                XNamespace f    = "http://fogid.net/o/";
                XElement   root = new XElement(r + "RDF",
                                               new XAttribute(XNamespace.Xmlns + "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
                                               new XAttribute(XNamespace.Xmlns + "fog", "http://fogid.net/o/"),
                                               null);
                foreach (XElement xel in fog.Elements())
                {
                    XElement xel2 = xel;
                    if (xel.Name.LocalName == "delete")
                    {
                        this.count_delete++;
                        xel2 = new XElement("del", new XAttribute(r + "about", xel.Attribute("id").Value));
                    }
                    if (xel.Name.LocalName == "substitute")
                    {
                        this.count_substitute++;
                    }

                    var pref1 = xel.GetPrefixOfNamespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
                    if (pref1 == null)
                    {
                        continue;                // Это не фог! TODO: нужна диагностика!
                    }
                    var pref2 = xel.GetPrefixOfNamespace("http://fogid.net/o/");
                    if (pref2 == null)
                    {
                        var xel3 = DbAdapter.ConvertXElement(xel2);
                        //var xel4 = new XElement(xel3.Name, xel3.Elements()
                        //    .Where(el => el.Attribute(r+"resource") != null || string.IsNullOrEmpty(el.Value))
                        //    .Select(el => new XElement(el))
                        //    );
                        foreach (var e in xel3.Elements())
                        {
                            if (e.Attribute(r + "resource") == null && string.IsNullOrEmpty(e.Value))
                            {
                                e.Remove();
                            }
                        }
                        root.Add(xel3);
                    }
                }
                if (root.Elements().Count() > 0)
                {
                    root.Add(
                        new XAttribute(fog.Attribute("dbid")),
                        new XAttribute(fog.Attribute("owner")),
                        new XAttribute(fog.Attribute("uri")),
                        new XAttribute(fog.Attribute("prefix")),
                        new XAttribute(fog.Attribute("counter")),
                        null);
                    root.Save(filename + ".xml");
                    fog = root;
                }
                db.Add(fog);
            }
        }
Beispiel #4
0
 public override void InitAdapter(DbAdapter adapter)
 {
     this.adapter = adapter;
     // Что-то нужное
     adapter.Init(xconfig.Element("database")?.Attribute("connectionstring")?.Value);
 }
Beispiel #5
0
 public override void InitAdapter(DbAdapter adapter)
 {
     //throw new NotImplementedException();
 }