Exemple #1
0
 public void AddResource(SqlResource resource)
 {
     foreach (var item in resource.Sqls)
     {
         SqlDict.Add(item.Key, item.Value);
     }
 }
Exemple #2
0
        private static void ProcessSqlResources(DaoConfig config, XDocument xdoc, Assembly assembey)
        {
            IEnumerable <XElement> resources = xdoc.Root.Element("SqlResources").Elements("SqlResource");

            foreach (var item in resources)
            {
                string      url      = item.Attribute("Url").Value;
                SqlResource resource = GetSqlResource(url, assembey);
                config.AddResource(resource);
            }
        }
Exemple #3
0
        private static SqlResource GetSqlResource(string url, Assembly assembly)
        {
            SqlResource resource = new SqlResource();

            resource.Url = url;

            XDocument resourceDoc = GetXDocument(url, assembly);

            var xsqls = resourceDoc.Root.Elements("sql");

            foreach (var xsql in xsqls)
            {
                Sql sql = new Sql();
                sql.Id   = xsql.Attribute("id").Value;
                sql.Text = xsql.ToString().Replace("\n", " ");
                resource.AddSql(sql);
            }

            return(resource);
        }