Hi,
I has a problem to setup a local test environment, i want to use sqlite to test my service, but i can not use the POCO generated by sqlserver, they has scheme : [Schema(“dbo”)]
i can not insert data into sqlite by these POCOS.
Why use sqlite?
Because i want use sqlite to init some test data and test service without my remote sqlserver.
I find servicestack has some integrate example use memory auth repository, i do not know if it’s a good idea, because if there are errors, i want to check the data in the sqlite.
sqlserver is so big and i can not install it on my mac(i use windows vm on mac, it’s slow). hate it.
private void MigrateSQLServer2Sqlite(Funq.Container container)
{
var connectionString =
"your string"
var sqlserver = new OrmLiteConnectionFactory(connectionString,
SqlServerOrmLiteDialectProvider.Instance);
using (var dbSqlServer = sqlserver.Open())
{
var notice = dbSqlServer.Select<Notice>();
using (var dbSQLLite = container.Resolve<IDbConnectionFactory>().Open())
{
// dbSQLLite.CreateTableIfNotExists<Notice>(); will add dbo_ prefix
dbSQLLite.Insert(notice); // throw can not find table
}
}
}
[Alias("Notice")]
[Schema("dbo")]
public partial class Notice : IHasId<long>
{
[Alias("NoticeId")]
[AutoIncrement]
public long Id { get; set; }
[Required]
public int KindergartenId { get; set; }
[Required]
public int ClassId { get; set; }
}
Should i must register connect in the factory? i just connect to sqlserver(new a OrmLiteConnectionFactory) and select tables and then insert into the tables of sqlite.