private static List <Tuple <String, String, object> > RunMethods(ViableMapAndData aMap, List <dynamic> objects) { List <Tuple <String, String, object> > results = new List <Tuple <String, String, object> >(); var methodStore = aMap.StoredData.Where(x => x.MapType.Equals(DataMapType.MethodParameterMap) && !x.DataStoreName.Equals(ParameterExtruder.Constructor)); if (methodStore.Any()) { foreach (DataStore aStore in methodStore) { foreach (DataRow aRow in aStore.ActualData.Rows) { foreach (dynamic anObject in objects) { MethodInfo method = anObject.GetType().GetMethod(aStore.DataStoreName); List <object[]> paramList = ParameterExtruder.BuildParameterArrayList(aMap, method.Name); if (paramList.Count > 0) { foreach (Object[] parameters in paramList) { results.Add(InvokeMethod(method, anObject, parameters, aStore.DataStoreName)); } } else { results.Add(InvokeMethod(method, anObject, null, aStore.DataStoreName)); } } } } } return(results); }
public static ViableMapAndData LoadMap(string fileName) { ViableMapAndData loadedMap = null; FileSerializations.FileDeserialization(fileName, ref loadedMap); return(loadedMap); }
public static List <Object[]> BuildParameterArrayList(ViableMapAndData aMap, string methodName) { List <Object[]> parameterList = new List <object[]>(); var methodStores = aMap.StoredData.Where(x => x.MapType.Equals(DataMapType.MethodParameterMap)); if (methodStores.Any()) { var parameterStores = methodStores.Where(x => x.DataStoreName.Equals(methodName)); if (parameterStores != null) { foreach (DataStore aStore in parameterStores) { if (aStore.ActualData != null) { MethodParameterMap aParamMap = ParameterExtruder.GetParameterMap(methodName, aMap.TheMap, aStore.ActualData.Columns.Count); foreach (DataRow aRow in aStore.ActualData.Rows) { object[] parameters = ParameterExtruder.ExtractParameters(aParamMap, aRow); parameterList.Add(parameters); } } else { parameterList.Add(null); } } } } return(parameterList); }
/// <summary> /// intitializes objects with properties and fields from data stores. /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> public static List <dynamic> CreateAndIntializePropertiesAndFields(ViableMapAndData aMap, Assembly anAssembly) { List <dynamic> results = new List <dynamic>(); results.AddRange(CreateAndInitializeProperties(aMap, anAssembly)); InitializeFields(aMap, results); return(results); }
/// <summary> /// intitializes objects fields from data stores. /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> private static void InitializeFields(ViableMapAndData aMap, List <dynamic> createdObjects) { var FieldStore = aMap.StoredData.Where(x => x.MapType.Equals(DataMapType.FieldColumnMap)).FirstOrDefault(); int count = -1; foreach (dynamic anObject in createdObjects) { InI.InitializeFields(anObject, aMap.TheMap, FieldStore.ActualData.Rows[count]); } }
public static List <String> CreateTemplateParams(ViableMapAndData data) { List <String> results = new List <string>(); foreach (DataStore aStore in data.StoredData) { results.AddRange(CreateTemplateParams(aStore.ActualData, data.TheMap, aStore.DataStoreName, String.Empty)); } return(results); }
/// <summary> /// intitializes objects with fields from data stores. /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> private static List <dynamic> CreateAndInitializeFields(ViableMapAndData aMap, Assembly anAssembly, object[] parameters) { List <dynamic> result = new List <dynamic>(); var fieldStore = aMap.StoredData.Where(x => x.MapType.Equals(DataMapType.FieldColumnMap)).FirstOrDefault(); foreach (DataRow aRow in fieldStore.ActualData.Rows) { dynamic anObject = InI.CreateObjectFromAssembly(anAssembly, aMap.TheMap.ClassName, parameters); InI.InitializeFields(anObject, aMap.TheMap, aRow); result.Add(anObject); } return(result); }
/// <summary> /// creates objects with parameters in their constructors /// </summary> /// <param name="fileName"></param> /// <param name="anAssembly"></param> private static List <dynamic> CreateAndInitializeFields(ViableMapAndData aMap, Assembly anAssembly) { List <dynamic> result = new List <dynamic>(); List <Object[]> parameterList = ParameterExtruder.BuildParameterArrayList(aMap, ".ctor"); if (parameterList.Count > 0) { foreach (Object[] parameters in parameterList) { result.AddRange(CreateAndInitializeFields(aMap, anAssembly, parameters)); } } else { result.AddRange(CreateAndInitializeFields(aMap, anAssembly, null)); } return(result); }
/// <summary> /// creates objects with parameters in their constructors /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> /// <returns></returns> private static List <dynamic> CreateAndInitializeProperties(ViableMapAndData aMap, string assemblyLocation) { Assembly anAssembly = Assembly.LoadFrom(assemblyLocation); return(CreateAndInitializeProperties(aMap, anAssembly)); }
private static List <Tuple <String, String, object> > CreateObjectInitializeFieldsAndRunMethods(ViableMapAndData aMap, Assembly anAssembly) { List <Tuple <String, String, object> > results = new List <Tuple <String, String, object> >(); List <dynamic> injectedObjects = new List <dynamic>(); List <Object[]> constructorParams = ParameterExtruder.BuildParameterArrayList(aMap, ParameterExtruder.Constructor); foreach (Object[] ctorParameters in constructorParams) { injectedObjects.Add(CreateAndInitializeFields(aMap, anAssembly, ctorParameters)); } if (injectedObjects.Any()) { results = RunMethods(aMap, injectedObjects); } return(results); }
public static List <Tuple <String, String, object> > CreateObjectInitializeFieldsAndRunMethods(string fileName, Assembly anAssembly) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateObjectInitializeFieldsAndRunMethods(aMap, anAssembly)); }
/// <summary> /// No parameters in Constructor /// </summary> /// <param name="aMap"></param> /// <param name="anAssembly"></param> /// <returns></returns> private static List <Tuple <String, String, object> > CreateInitializePropertiesFieldsAndRunMethodsWoParams(ViableMapAndData aMap, Assembly anAssembly) { List <dynamic> injectedObjects = new List <dynamic>(); injectedObjects.AddRange(CreateAndIntializePropertiesAndFieldsWoParams(aMap, anAssembly)); return(RunMethods(aMap, injectedObjects)); }
//creates objects and initializes fields wiht paramters in constructor public static List <dynamic> CreateAndInitializeFields(string fileName, Assembly anAssembly) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateAndInitializeFields(aMap, anAssembly)); }
private void lstMappedSources_SelectedIndexChanged(object sender, EventArgs e) { currentMappedSource = (ViableMapAndData)lstMappedSources.SelectedItems[0].Tag; }
/// <summary> /// No parameters in constructor /// </summary> /// <param name="fileName"></param> /// <param name="anAssembly"></param> /// <returns></returns> public static List <Tuple <String, String, object> > CreateObjectAndRunMethodsNoParams(string fileName, Assembly anAssembly) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateObjectAndRunMethodsNoParams(aMap, anAssembly, null)); }
/// <summary> /// creates objects without parameters in their constructors /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> /// <returns></returns> public static List <dynamic> CreateAndInitializePropertiesWoParams(string fileName, Assembly anAssembly) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateAndInitializeProperties(aMap, anAssembly, null)); }
/// <summary> /// No parameters in constructor /// </summary> /// <param name="aMap"></param> /// <param name="anAssembly"></param> /// <param name="parameters"></param> /// <returns></returns> private static List <Tuple <String, String, object> > CreateObjectAndRunMethodsNoParams(ViableMapAndData aMap, Assembly anAssembly, object[] parameters) { List <dynamic> injectedObjects = new List <dynamic>(); dynamic anObject = InI.CreateObjectFromAssembly(anAssembly, aMap.TheMap.ClassName, parameters); injectedObjects.Add(anObject); return(RunMethods(aMap, injectedObjects)); }
private static List <dynamic> CreateAndInitializePropertiesWoParams(ViableMapAndData aMap, Assembly anAssembly) { return(CreateAndInitializeProperties(aMap, anAssembly, null)); }
/// <summary> /// creates objects with parameters in their constructors /// </summary> /// <param name="fileName"></param> /// <param name="assemblyLocation"></param> /// <returns></returns> public static List <dynamic> CreateAndInitializeProperties(string fileName, string assemblyLocation) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateAndInitializeProperties(aMap, assemblyLocation)); }
/// <summary> /// No paramters in constuctor /// </summary> /// <param name="fileName"></param> /// <param name="anAssembly"></param> /// <returns></returns> private static List <Tuple <String, String, object> > CreateInitializePropertiesFieldsAndRunMethodsWoParams(string fileName, Assembly anAssembly) { ViableMapAndData aMap = ReadObject.LoadMap(fileName); return(CreateInitializePropertiesFieldsAndRunMethodsWoParams(aMap, anAssembly)); }
public static void Buildrule(MappedSourceRule aRule, ViableMapAndData mappedSource) { aRule.MappedSource = mappedSource; }
public static void StoreMapAndData(ViableMapAndData all, String fileName) { FileSerializations.FileSerialization(fileName, all); }