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); }
public CanCompute <Int64> NewInt64(LocalBuilder value) { if (value.LocalType != typeof(Int64)) { ManagerGX.ShowEx("Type not is [Int64]"); } return(new CanCompute <Int64>(value, this)); }
public FieldBoolean NewBoolean(LocalBuilder value) { if (value.LocalType != typeof(Boolean)) { ManagerGX.ShowEx("Type not is [Boolean]"); } return(new FieldBoolean(value, this)); }
public CanCompute <Byte> NewByte(LocalBuilder value) { if (value.LocalType != typeof(Byte)) { ManagerGX.ShowEx("Type not is [Byte]"); } return(new CanCompute <Byte>(value, this)); }
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)); }
public FieldString NewString(LocalBuilder value) { if (value.LocalType != typeof(String)) { ManagerGX.ShowEx("Type not is [String]"); } return(new FieldString(value, this)); }
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)); }
public FieldDateTime NewDateTime(LocalBuilder value) { if (value.LocalType != typeof(DateTime)) { ManagerGX.ShowEx("Type not is [DateTime]"); } return(new FieldDateTime(value, this)); }
public CanCompute <Decimal> NewDecimal(LocalBuilder value) { if (value.LocalType != typeof(Decimal)) { ManagerGX.ShowEx("Type not is [Decimal]"); } return(new CanCompute <Decimal>(value, this)); }
public CanCompute <Double> NewDouble(LocalBuilder value) { if (value.LocalType != typeof(Double)) { ManagerGX.ShowEx("Type not is [Double]"); } return(new CanCompute <Double>(value, this)); }
public CanCompute <Single> NewFloat(LocalBuilder value) { if (value.LocalType != typeof(Single)) { ManagerGX.ShowEx("Type not is [Single]"); } return(new CanCompute <Single>(value, this)); }
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); }
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); }