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);
        }
Example #2
0
        public void AddMigrationHandler <TSource>(IMigrationHandler <TSource> migrationHandler)
        {
            Type handlerType = typeof(TSource);

            migrationHandlers[handlerType] = migrationHandler;
        }
Example #3
0
 public MigrationService(IMigrationHandler migrationHandler)
 {
     _migrationHandler = migrationHandler
                         ?? throw new NullReferenceException();
 }