Exemple #1
0
        public LocalBuilder this[String Name]
        {
            get
            {
                if (!ContanisKey(Name))
                {
                    ManagerGX.ShowEx("Entity prop is null;");
                }
                LocalBuilder item = generator.DeclareLocal(EntityBody[Name].type);
                Output();
                Emit(OpCodes.Callvirt, EntityBody[Name].get);
                Emit(OpCodes.Stloc_S, item);
                return(item);
            }

            set
            {
                if (!ContanisKey(Name))
                {
                    ManagerGX.ShowEx("Entity prop is null;");
                }
                Output();
                Emit(OpCodes.Ldloc_S, value);
                Emit(OpCodes.Callvirt, EntityBody[Name].set);
            }
        }
        private static LocalBuilder MapToEntity(this EmitBasic basic, Object instance, Type type)
        {
            if (instance == null)
            {
                ManagerGX.ShowEx("entity is not null!");
            }
            var ctor = type.GetConstructor(Type.EmptyTypes);

            if (!ctor.IsPublic)
            {
                ManagerGX.ShowEx("type need ctor public!");
            }
            var          name  = type.FullName;
            LocalBuilder model = basic.DeclareLocal(type);

            basic.Emit(OpCodes.Newobj, type);
            basic.Emit(OpCodes.Stloc_S, model);

            FastProperty[] emits = type.CachePropsManager();

            for (int i = 0; i < emits.Length; i++)
            {
                var propValue = emits[i].Get(instance);
                if (propValue == null)
                {
                    continue;
                }
                basic.Emit(OpCodes.Ldloc_S, model);
                basic.EmitValue(propValue, emits[i].PropertyType);
                basic.Emit(OpCodes.Callvirt, emits[i].SetMethod);
            }
            return(model);
        }
Exemple #3
0
 public CanCompute <Int64> NewInt64(LocalBuilder value)
 {
     if (value.LocalType != typeof(Int64))
     {
         ManagerGX.ShowEx("Type not is [Int64]");
     }
     return(new CanCompute <Int64>(value, this));
 }
Exemple #4
0
 public FieldBoolean NewBoolean(LocalBuilder value)
 {
     if (value.LocalType != typeof(Boolean))
     {
         ManagerGX.ShowEx("Type not is [Boolean]");
     }
     return(new FieldBoolean(value, this));
 }
Exemple #5
0
 public CanCompute <Byte> NewByte(LocalBuilder value)
 {
     if (value.LocalType != typeof(Byte))
     {
         ManagerGX.ShowEx("Type not is [Byte]");
     }
     return(new CanCompute <Byte>(value, this));
 }
Exemple #6
0
 public FieldList <T> NewList <T>(LocalBuilder value)
 {
     if (value.LocalType != typeof(List <T>))
     {
         ManagerGX.ShowEx($"Type not is [{typeof(List<T>)?.Name}]");
     }
     return(new FieldList <T>(value, this));
 }
Exemple #7
0
 public FieldString NewString(LocalBuilder value)
 {
     if (value.LocalType != typeof(String))
     {
         ManagerGX.ShowEx("Type not is [String]");
     }
     return(new FieldString(value, this));
 }
Exemple #8
0
 public FieldArray <T> NewArray <T>(LocalBuilder value)
 {
     if (value.LocalType != typeof(T))
     {
         ManagerGX.ShowEx($"Type not is [{typeof(T)?.BaseType?.Name}]");
     }
     return(new FieldArray <T>(value, this, -1));
 }
Exemple #9
0
 public FieldDateTime NewDateTime(LocalBuilder value)
 {
     if (value.LocalType != typeof(DateTime))
     {
         ManagerGX.ShowEx("Type not is [DateTime]");
     }
     return(new FieldDateTime(value, this));
 }
Exemple #10
0
 public CanCompute <Decimal> NewDecimal(LocalBuilder value)
 {
     if (value.LocalType != typeof(Decimal))
     {
         ManagerGX.ShowEx("Type not is [Decimal]");
     }
     return(new CanCompute <Decimal>(value, this));
 }
Exemple #11
0
 public CanCompute <Double> NewDouble(LocalBuilder value)
 {
     if (value.LocalType != typeof(Double))
     {
         ManagerGX.ShowEx("Type not is [Double]");
     }
     return(new CanCompute <Double>(value, this));
 }
Exemple #12
0
 public CanCompute <Single> NewFloat(LocalBuilder value)
 {
     if (value.LocalType != typeof(Single))
     {
         ManagerGX.ShowEx("Type not is [Single]");
     }
     return(new CanCompute <Single>(value, this));
 }
Exemple #13
0
 public void SetValue(String FieldName, LocalBuilder value)
 {
     if (!ContanisKey(FieldName))
     {
         ManagerGX.ShowEx("Entity property is null;");
     }
     Output();
     Emit(OpCodes.Ldloc_S, value);
     Emit(OpCodes.Callvirt, EntityBody[FieldName].set);
 }
Exemple #14
0
        public LocalBuilder GetValue(String FieldName)
        {
            if (!ContanisKey(FieldName))
            {
                ManagerGX.ShowEx("Entity property is null;");
            }
            LocalBuilder item = generator.DeclareLocal(EntityBody[FieldName].type);

            Output();
            Emit(OpCodes.Callvirt, EntityBody[FieldName].get);
            Emit(OpCodes.Stloc_S, item);
            return(item);
        }