public static string Text(this FSScope scope, Type type, int id, string defaultText = "")
        {
            var global = scope.FSGlobalContext;

            var typeName        = type.Name;
            var factoryTypeName = type.AssemblyQualifiedName.Replace(typeName, typeName.TrimStart('I') + "Factory");
            var mi = Type.GetType(factoryTypeName).GetMethod("GetText", new[] { global.FSGlobal.GetType(), id.GetType(), defaultText.GetType() });

            return(mi.Invoke(null, new object[] { global.FSGlobal, id, defaultText }) as string);
        }
示例#2
0
 public TFSEntity Create <TFSEntity>(FSScope scope)
     where TFSEntity : class, IDevFrameworkObject => scope.Create <TFSEntity>();
        public static TFSEntity MapTo <TSource, TFSEntity>(this TSource source, IMapper mapper, FSScope scope, Action <IMappingOperationOptions <TSource, TFSEntity> > opts)
            where TFSEntity : class, IDevFrameworkObject
        {
            var target = scope.Create <TFSEntity>();

            return(mapper.Map(source, target, opts));
        }
        //public static IEnumerable<TFSEntity> MapTo<TFSEntity>(this IEnumerable<object> source, FSScope scope)
        //    where TFSEntity : class, IDevFrameworkObject
        //{
        //    return Mapper.Map<IEnumerable<TFSEntity>>(source, opt => opt.ConstructServicesUsing(scope.Create));
        //}

        public static string Text <TTextColl>(this FSScope scope, int id, string defaultText = "")
        {
            return(Text(scope, typeof(TTextColl), id, defaultText));
        }
 public static TFSEntity MapTo <TFSEntity>(this object source, IMapper mapper, FSScope scope)
     where TFSEntity : class, IDevFrameworkObject
 {
     return(mapper.Map(source, scope.Create <TFSEntity>()));
 }