private static XmlSerializer GetSerializer <T>() { Activity.GetAllActivities(); return(new XmlSerializer(typeof(T), AppDomain.CurrentDomain.GetAssemblies().SelectMany( x => x.GetTypes()) .Where(t => typeof(Node).IsAssignableFrom(t) || typeof(Port).IsAssignableFrom(t) || typeof(Activity).IsAssignableFrom(t)).ToArray())); }
public static Activity CreateInstance(string activityId) { if (Activity.GetAllActivities().Where(x => x.FullName == activityId).FirstOrDefault() is Type activityType) { return(Activator.CreateInstance(activityType) as Activity); } else { throw new TypeLoadException(string.Format("Cannot create instance of '{0}' activity", activityId)); } }
public static Activity CreateInstance(string name) { var activityType = Activity.GetAllActivities().Where(x => x.FullName == name).First(); return(Activator.CreateInstance(activityType) as Activity); }