/// <summary> /// 添加到数据层 /// </summary> /// <param name="doc"></param> private static void AppendDalLoader(Assembly ass, XmlDocument doc) { XmlNodeList nodes = doc.GetElementsByTagName("dataaccess"); if (nodes.Count <= 0) { return; } XmlAttribute att = nodes[0].Attributes["name"]; if (att == null) { return; } string name = att.InnerText; DBInfo db = null; if (!_dicDBInfo.TryGetValue(name, out db)) { return; } string[] namespaces = db.DataaccessNamespace; XmlNodeList dalNodes = nodes[0].ChildNodes; foreach (XmlNode dalNode in dalNodes) { att = dalNode.Attributes["type"]; if (att == null) { continue; } string typeName = att.InnerText; foreach (string allNameSpace in namespaces) { if (typeName.StartsWith(allNameSpace)) { Type dalType = ass.GetType(typeName); if (dalType != null) { att = dalNode.Attributes["interface"]; if (att == null) { break; } _dicLoaderConfig[att.InnerText] = dalType; Type[] gTypes = DefaultType.GetGenericType(dalType, true); if (gTypes != null && gTypes.Length > 0) { Type gType = gTypes[0]; _dicEntityLoaderConfig[gType.FullName] = dalType; } } break; } } } }