/// <summary> /// The create. /// </summary> /// <param name="data"> /// The data. /// </param> /// <param name="createFunctions"> /// The create functions. /// </param> /// <returns> /// The <see cref="Entity"/>. /// </returns> public static Entity Create(Core.Entity data, string filename, EntityCreateFunctions createFunctions) { var type = createFunctions.GetEntityType(data.ClassName); if (type == null) { // TODO: Only once for each type //ClassGenerator.GenerateClassFromEntity(data, filename); return(null); } var instance = Activator.CreateInstance(type) as Entity;//ScriptableObject.CreateInstance(type) as Entity; return(instance); }
/// <summary> /// Creates FoxKit instances of the imported entities. /// </summary> /// <param name="foxFile"> /// The imported DataSet file. /// </param> /// <param name="entityCreateFunctions"> /// Helper functions to initialize an entity. /// </param> /// <returns> /// The created Entity instances. /// </returns> private static Dictionary <Entity, Core.Entity> CreateEntityInstances(IEnumerable <Core.Entity> rawEntities, string filename, EntityCreateFunctions entityCreateFunctions) { return((from entity in rawEntities select new { Data = entity, Instance = Create(entity, filename, entityCreateFunctions) }) .Where(entry => entry.Instance != null) .ToDictionary(entry => entry.Instance, entry => entry.Data)); }