in src/dotnet/Rider.Plugins.EfCore/Migrations/MigrationsProvider.cs [46:82]
private static bool TryGetMigrationInfo(IClass @class, out MigrationInfo migrationInfo)
{
migrationInfo = null;
var migrationShortName = @class.ShortName;
var migrationAttribute = @class.GetAttributeInstance("MigrationAttribute");
var dbContextAttribute = @class.GetAttributeInstance("DbContextAttribute");
if (dbContextAttribute is null || migrationAttribute is null)
return false;
var migrationLongName = migrationAttribute
.PositionParameter(0)
.ConstantValue
.StringValue;
var dbContextClass = dbContextAttribute
.PositionParameter(0)
.TypeValue
?.GetScalarType()
?.GetClrName();
if (migrationLongName is null || dbContextClass is null)
return false;
var migrationFolderAbsolutePath = @class.GetSourceFiles()
.FirstOrDefault()
.GetLocation().Directory.FileAccessPath;
migrationInfo = new MigrationInfo(
dbContextClass.FullName,
migrationShortName,
migrationLongName,
migrationFolderAbsolutePath);
return true;
}