Test in sqlite but work in sqlserver

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?

  1. 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.
  2. sqlserver is so big and i can not install it on my mac(i use windows vm on mac, it’s slow). hate it.

What problem are you having with SQLite and the [Schema] attribute?

Testing with the User test table in the Postgres tests, SQLite works fine for creating table, inserting and selecting.

Could you provide POCOs and OrmLite expression that is failing when inserting into SQLite?

please user sqlserver

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; }
  }

You can’t access multiple db connections like this. Please instead see the documentation of handling Multiple Database Connections.

You can only have 1 master connection, any other OrmLite db connections need to be registered with RegisterConnection(), e.g:

dbFactory.RegisterConnection("sqlite",
    "~/App_Data/{0}.sqlite".Fmt(shardId).MapAbsolutePath(),
    SqliteDialect.Provider);

Which you then need to use OpenConnection(name) to access, e.g:

using (var dbSqlite = dbFactory.OpenDbConnection("sqlite"))
{
    ...
}

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.