Пример #1
0
        public void Can_select_from_FileStream()
        {
            ConnectionString = "Data Source=localhost;Initial Catalog=test2;User Id=test;Password=test;Connect Timeout=120;MultipleActiveResultSets=True;Type System Version=SQL Server 2012;";
            var dialectProvider = SqlServerConverters.Configure(SqlServer2012Dialect.Provider);
            var dbFactory       = new OrmLiteConnectionFactory(ConnectionString, dialectProvider);

            using (var db = dbFactory.OpenDbConnection())
            {
                db.DropTable <TestFile>();
                db.CreateTable <TestFile>();

                db.Insert(new TestFile {
                    Contents = "contents".ToUtf8Bytes()
                });

                db.Select <TestFile>().PrintDump();

                //db.DropTable<FileStream>();
                //db.CreateTable<FileStream>();

                //db.Insert(new FileStream
                //{
                //    Name = "file.txt",
                //    Path = SqlHierarchyId.Parse("/1/2/3/"),
                //    ParentPath = SqlHierarchyId.Parse("/1/2/"),
                //    FileContent = "contents".ToUtf8Bytes(),
                //    FileType = MimeTypes.PlainText,
                //});

                //var q = db.From<FileStream>();
                //db.Select(q);
            }
        }
Пример #2
0
        public override void TestFixtureSetUp()
        {
            LogManager.LogFactory = new ConsoleLogFactory();

            // Sql Server In-Memory OLTP does not support MARS
            ConnectionString = GetConnectionString().Replace("MultipleActiveResultSets=True;", "");

            var dialectProvider = SqlServerConverters.Configure(SqlServer2016Dialect.Provider);

            Db = new OrmLiteConnectionFactory(ConnectionString, dialectProvider).OpenDbConnection();
        }
Пример #3
0
        public override void TestFixtureSetUp()
        {
            LogManager.LogFactory = new ConsoleLogFactory();

            // Appending the Sql Server Type System Version to use SqlServerSpatial110.dll (2012) assembly
            // Sql Server defaults to SqlServerSpatial100.dll (2008 R2) even for versions greater
            // https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx
            ConnectionString = GetConnectionString() + "Type System Version=SQL Server 2012;";

            var dialectProvider = SqlServerConverters.Configure(SqlServer2016Dialect.Provider);

            Db = new OrmLiteConnectionFactory(ConnectionString, dialectProvider).OpenDbConnection();
        }
Пример #4
0
        public override void TestFixtureSetUp()
        {
            try
            {
                LogManager.LogFactory = new ConsoleLogFactory();

                // Sql Server In-Memory OLTP does not support MARS
                ConnectionString = ConfigurationManager.ConnectionStrings["testDb"].ConnectionString.Replace("MultipleActiveResultSets=True;", "");

                var dialectProvider = SqlServerConverters.Configure(SqlServer2016Dialect.Provider);

                Db = new OrmLiteConnectionFactory(ConnectionString, dialectProvider).OpenDbConnection();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void TestFixtureSetUp()
        {
            try
            {
                LogManager.LogFactory = new ConsoleLogFactory();

                // Appending the Sql Server Type System Version to use SqlServerSpatial110.dll (2012) assembly
                // Sql Server defaults to SqlServerSpatial100.dll (2008 R2) even for versions greater
                // https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx
                ConnectionString = ConfigurationManager.ConnectionStrings["testDb"].ConnectionString + ";Type System Version=SQL Server 2012;";

                var dialectProvider = SqlServerConverters.Configure(SqlServer2012Dialect.Provider);

                Db = new OrmLiteConnection(new OrmLiteConnectionFactory(ConnectionString, dialectProvider));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }