private bool SetMigrationHandlerInstance(Type type) { if (!typeof(IMigrationHandler).IsAssignableFrom(type)) { Debug.LogError($"{type.Name} is not a valid implementation of IMigrationHandler"); return(false); } if (!migrationHandlerTypes.Contains(type)) { Debug.LogError($"{type.Name} might not be a valid implementation of IMigrationHandler"); return(false); } try { migrationHandlerInstance = Activator.CreateInstance(type) as IMigrationHandler; } catch (Exception) { Debug.LogError("Selected MigrationHandler implementation could not be instanciated"); return(false); } return(true); }
public void AddMigrationHandler <TSource>(IMigrationHandler <TSource> migrationHandler) { Type handlerType = typeof(TSource); migrationHandlers[handlerType] = migrationHandler; }
public MigrationService(IMigrationHandler migrationHandler) { _migrationHandler = migrationHandler ?? throw new NullReferenceException(); }