Esempio n. 1
0
        private static ExtensionList CreateTypeInfo(XDocument doc)
        {
            var list = new ExtensionList();

            foreach (var typeNode in doc.Root.Elements().Where(_ => _.Name.LocalName == NodeName.Type))
            {
                list.Add(ParseType(typeNode));
            }

            return(list);
        }
Esempio n. 2
0
        private static ExtensionList CreateTypeInfo(XmlDocument doc)
        {
            ExtensionList list = new ExtensionList();

            foreach (XmlNode typeNode in doc.DocumentElement.ChildNodes)
            {
                if (typeNode.LocalName == NodeName.Type)
                {
                    list.Add(ParseType(typeNode));
                }
            }

            return(list);
        }
 public static void MergeExtensions(ExtensionList fromExt, ref ExtensionList toExt)
 {
     foreach (var kv in fromExt)
     {
         TypeExtension toType;
         if (toExt.TryGetValue(kv.Key, out toType))
         {
             MergeExtensions(kv.Value, ref toType);
         }
         else
         {
             toExt.Add(kv.Key, kv.Value);
         }
     }
 }
Esempio n. 4
0
        public static TypeExtension GetTypeExtension(Type type, ExtensionList typeExtensions)
        {
            var attrs = type.GetCustomAttributes(typeof(TypeExtensionAttribute), true);

            if (attrs != null && attrs.Length != 0)
            {
                var attr = (TypeExtensionAttribute)attrs[0];

                if (!string.IsNullOrEmpty(attr.FileName))
                {
                    typeExtensions = GetExtensions(attr.FileName, type.Assembly);
                }

                if (typeExtensions != null && !string.IsNullOrEmpty(attr.TypeName))
                {
                    return(typeExtensions[attr.TypeName]);
                }
            }

            return(typeExtensions != null? typeExtensions[type]: Null);
        }
Esempio n. 5
0
		private static ExtensionList CreateTypeInfo(XDocument doc)
		{
			var list = new ExtensionList();

			foreach (var typeNode in doc.Root.Elements().Where(_ => _.Name.LocalName == NodeName.Type))
				list.Add(ParseType(typeNode));

			return list;
		}
Esempio n. 6
0
		public static TypeExtension GetTypeExtension(Type type, ExtensionList typeExtensions)
		{
			var attrs = type.GetCustomAttributes(typeof(TypeExtensionAttribute), true);

			if (attrs != null && attrs.Length != 0)
			{
				var attr = (TypeExtensionAttribute)attrs[0];

				if (!string.IsNullOrEmpty(attr.FileName))
					typeExtensions = GetExtensions(attr.FileName, type.Assembly);

				if (typeExtensions != null && !string.IsNullOrEmpty(attr.TypeName))
					return typeExtensions[attr.TypeName];
			}

			return typeExtensions != null? typeExtensions[type]: Null;
		}
Esempio n. 7
0
		private static ExtensionList CreateTypeInfo(XmlDocument doc)
		{
			ExtensionList list = new ExtensionList();

			foreach (XmlNode typeNode in doc.DocumentElement.ChildNodes)
				if (typeNode.LocalName == NodeName.Type)
					list.Add(ParseType(typeNode));

			return list;
		}
 public override string GetDatabaseName(Type type, ExtensionList extensions, out bool isSet)
 {
     return base.GetDatabaseName(type, extensions, out isSet);
 }
 public override string GetTableName(Type type, ExtensionList extensions, out bool isSet)
 {
     var tblAttrs = TypeHelper.GetAttributes(type, typeof(TableAttribute));
     if (tblAttrs != null && tblAttrs.Length > 0)
     {
         string name = ((TableAttribute)tblAttrs[0]).Name;
         isSet = !string.IsNullOrEmpty(name);
         return name;
     }
     return base.GetTableName(type, extensions, out isSet);
 }
 public override List<MapRelationBase> GetRelations(MappingSchema schema, ExtensionList typeExt, Type master, Type slave, out bool isSet)
 {
     return base.GetRelations(schema, typeExt, master, slave, out isSet);
 }