Exemple #1
0
        public void TransactionTest()
        {
            var connection = new SqlConnectionInfo();

            connection.DatabaseName = "TEST";
            connection.ServerName   = "test.opennetcf.com";
            connection.ServerPort   = 1433;
            connection.UserName     = "******";
            connection.Password     = "******";

            var store = new SqlServerDataStore(connection);

            try
            {
                store.AddType <PublishedTenantBuildingState>();
                store.AddType <PublishedTenantApartmentState>();

                var b = new PublishedTenantBuildingState()
                {
                    PublishID     = Guid.NewGuid(),
                    RecordDateUtc = DateTime.Now.ToUniversalTime()
                };
                var a1 = new PublishedTenantApartmentState()
                {
                    PublishID = Guid.NewGuid(),
                    PublishedBuildingStateID = b.PublishID,
                    SpaceTemperature         = 1
                };
                var a2 = new PublishedTenantApartmentState()
                {
                    PublishID = Guid.NewGuid(),
                    PublishedBuildingStateID = b.PublishID,
                    SpaceTemperature         = 2
                };


                store.BeginTransaction();
                store.Insert(b);
                store.Insert(a1);
                store.Insert(a2);
                store.Commit();
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        public void GuidPKTest()
        {
            var store = new SqlServerDataStore(GetInfo());

            store.AddType <GuidItem>();

            var item = new GuidItem();

            store.Insert(item);


            var results = store.Select <GuidItem>().ToArray();

            results[0].FieldA = 42;
            store.Update(results[0]);
            results = store.Select <GuidItem>().ToArray();
        }