SHARE
TWEET

Untitled

a guest Aug 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class CustomCSharpMigrationCodeGenerator : CSharpMigrationsGenerator
  2.     {
  3.         public override string GenerateMigration(string migrationNamespace,
  4.             string migrationName,
  5.             IReadOnlyList<MigrationOperation> upOperations,
  6.             IReadOnlyList<MigrationOperation> downOperations)
  7.         {
  8.             throw new Exception("Hello world");
  9.             return base.GenerateMigration(migrationNamespace, migrationName, upOperations, downOperations);
  10.         }
  11.  
  12.         public CustomCSharpMigrationCodeGenerator(MigrationsCodeGeneratorDependencies dependencies,
  13.             CSharpMigrationsGeneratorDependencies csharpDependencies) : base(dependencies, csharpDependencies)
  14.         {
  15.             throw new Exception("Hello world");
  16.         }
  17.     }
  18.      
  19. public class MyDesignTimeServices : IDesignTimeServices
  20. {
  21.     public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
  22.     {
  23.         serviceCollection.AddSingleton<CSharpMigrationsGenerator, CustomCSharpMigrationCodeGenerator>();
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top