Closed ChaseFlorell closed 10 years ago
This was completed in SHA: 5b51f282d0fe060e20c430011cb211bcfd2b54ca
Usage:
First create a custom type interface in your shared PCL.
public interface ICustomDialect
{
string LatLong { get; }
}
Then implement it in each of your platform specific code.
// This is in a Server project
public class CustomDialect : ICustomDialect
{
public string LatLong { get { return "decimal(9, 6)"; } }
}
And register it
container.Register<ICustomDialect, CustomDialect>();
From there, you can use it in your migrations.
public class Migration001: Migration {
private readonly ICustomDialect _customDialect;
public Migration001(ICustomDialect customDialect) {
_customDialect = customDialect;
}
public override void Migrate() {
var locationTable = database.AddTable("Locations");
timeEventTable.AddColumn("Latitude", typeof (LatLong)).AsCustomType(_customDialect.LatLong); // here's where you add support
timeEventTable.AddColumn("Longitude", typeof (LatLong)).AsCustomType(_customDialect.LatLong); // and here also
DbProvider.ExecuteNonQuery(migration.GenerateDDL(database));
}
}
Check the Test if you're stumped.
We have a separate application where we have a custom
LatLong
type. We need to be able to add custom types without recompilingAppCore.Data
.