using System; using System.Collections.Generic; using System.Text; using Zhaizj.Framework.Reflection; using Zhaizj.Framework.ORM; namespace Zhaizj.Framework { /// /// 实体类常用方法 /// public class Entity { /// /// 根据类型全名,创建持久化对象 /// /// 类型的全名 /// 返回一个 IEntity 持久化对象 public static IEntity New( String typeFullName ) { IConcreteFactory factory = (IConcreteFactory)MappingClass.Instance.FactoryList[typeFullName]; return factory == null ? null : factory.New(); } /// /// 获取类型 t 的元数据信息 /// /// /// public static EntityInfo GetInfo( Type t ) { return MappingClass.Instance.ClassList[t.FullName] as EntityInfo; } /// /// 获取类型 typeFullName 的元数据信息 /// /// 类型全名,包括namespace,但不包括程序集 /// public static EntityInfo GetInfo( String typeFullName ) { return MappingClass.Instance.ClassList[typeFullName] as EntityInfo; } /// /// 获取对象 obj 的元数据信息 /// /// /// public static EntityInfo GetInfo( Object obj ) { return GetInfo( obj.GetType() ); } /// /// 根据全名获取类型 /// /// /// public static Type GetType( String typeFullName ) { return MappingClass.Instance.TypeList[typeFullName] as Type; } } }