/// <summary> /// 获取指定类型的日志序列化实例(从缓存中获取) /// </summary> /// <param name="t"></param> /// <returns></returns> public static ILogWriter[] GetWriters(Type t) { if (Config.Enable == false) { return(null); } DataTypeCacheItem cacheItem = (DataTypeCacheItem)s_writerTable[t.FullName]; if (cacheItem == null) { return(null); } return(cacheItem.Instances); }
/// <summary> /// 创建指定类型的日志序列化实例 /// </summary> /// <param name="t"></param> /// <returns></returns> public static ILogWriter[] CreateWriters(Type t) { if (Config.Enable == false) { return(null); } DataTypeCacheItem cacheItem = (DataTypeCacheItem)s_writerTable[t.FullName]; if (cacheItem == null) { return(null); } return((from x in cacheItem.WriteTypes select(ILogWriter) Activator.CreateInstance(x) ).ToArray()); }