Пример #1
0
        public static TIParentService GetChildService <TIParentService>(string remotingServiceUrl)
        {
            Dictionary <string, Type> entityPropertyDic = new Dictionary <string, Type>();
            Type type = typeof(TIParentService);

            foreach (PropertyInfo info in type.GetProperties())
            {
                if (info.CanRead)
                {
                    entityPropertyDic.Add(info.Name, info.PropertyType);
                }
            }
            Type   type2 = DynamicEntityFactory.CreateEntityType("CT" + TypeHelper.GetClassSimpleName(typeof(TIParentService)), entityPropertyDic, typeof(TIParentService));
            object obj2  = Activator.CreateInstance(type2);

            foreach (PropertyInfo info in type2.GetProperties())
            {
                if (info.CanRead)
                {
                    object obj3 = Activator.GetObject(info.PropertyType, string.Format("{0}/{1}", remotingServiceUrl, info.Name));
                    info.GetSetMethod().Invoke(obj2, new object[] { obj3 });
                }
            }
            return((TIParentService)obj2);
        }
Пример #2
0
        public IEntityConverter <TEntity> Build()
        {
            var entityType = new SchemaEntityInfo(typeof(TEntity), typeof(TSchema), _entitySelector);

            var entityFactory = new DynamicEntityFactory <TEntity>(ImplementationType, entityType);

            return(new DynamicEntityConverter <TEntity, TSchema>(entityType, entityFactory, _properties));
        }
Пример #3
0
        public IEntityMap <TEntity> Build()
        {
            var entityType = new SchemaEntityType(typeof(TEntity), typeof(TSchema), _entityTypeSelector);

            var entityFactory = new DynamicEntityFactory <TEntity>(ImplementationType, entityType);

            return(new DynamicEntityMap <TEntity, TSchema>(entityType, entityFactory, _properties, _sliceProviders));
        }