title: Use SqlGeography at ServiceStack.OrmLite in .Net Core
body: <p>I try to add SqlGeography to my model and when I call create table I got weird error.</p>
  
  <p>First I add this package: <code>Microsoft.SqlServer.Types</code></p>
  
  <p>Then I create my model like example at below:</p>
  
  <pre><code>public class Locations 
  {
     public int Id { get; set; }
     public string Name { get; set; }
     public SqlGeography Location { get; set; }
  }
  </code></pre>
  
  <p>Then call <code>CreateTableIfNotExists</code> to create table</p>
  
  <pre><code>private void CheckDB(IDbConnectionFactory dbConnectionFactory)
  {
      using (var db = dbConnectionFactory.Open())
      {
          db.CreateTableIfNotExists&lt;Models.Entities.DbIpEntity&gt;();
      }
  }
  </code></pre>
  
  <p>And at end I got this error:</p>
  
  <blockquote>
    <p>System.TypeLoadException   HResult=0x80131522   Message=Could not load
    type 'Microsoft.SqlServer.Server.IBinarySerialize' from assembly
    'System.Data, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'.   Source=System.Private.CoreLib<br>
    StackTrace:    at System.Signature.GetSignature(Void* pCorSig, Int32
    cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo
    methodHandle, RuntimeType declaringType)    at
    System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()    at
    System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()    at
    System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()    at
    System.Reflection.RuntimePropertyInfo.GetIndexParameters()    at
    ServiceStack.OrmLite.OrmLiteConfigExtensions.GetModelDefinition(Type
    modelType)    at
    ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.CreateTable(IDbCommand
    dbCmd, Boolean overwrite, Type modelType)    at
    ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn,
    Func`2 filter)    at
    ServiceStack.OrmLite.OrmLiteSchemaApi.DropAndCreateTable[T](IDbConnection
    dbConn)    at GeoApi.AppHost.CheckDB(IDbConnectionFactory
    dbConnectionFactory) in E:\Projects\Geo\AppHost.cs:line 48    at
    GeoApi.AppHost.Configure(Container container) in
    E:\Projects\Geo\AppHost.cs:line 40    at
    ServiceStack.ServiceStackHost.Init()    at
    ServiceStack.NetCoreAppHostExtensions.UseServiceStack(IApplicationBuilder
    app, AppHostBase appHost)    at
    GeoApi.Startup.Configure(IApplicationBuilder app, IHostingEnvironment
    env) in E:\Projects\Geo\Startup.cs:line 49</p>
  </blockquote>
  
  <p>In this error I realized it's looking for .Net Framework assembly ( <code>System.Data, Version=4.0.0.0</code> ) not .Net Core </p>