当前位置: 首页>>代码示例>>C#>>正文


C# Data.TransactionManager类代码示例

本文整理汇总了C#中Northwind.Data.TransactionManager的典型用法代码示例。如果您正苦于以下问题:C# TransactionManager类的具体用法?C# TransactionManager怎么用?C# TransactionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransactionManager类属于Northwind.Data命名空间,在下文中一共展示了TransactionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateMockInstance

        ///<summary>
        ///  Update the Typed CustomerCustomerDemo Entity with modified mock values.
        ///</summary>
        public static void UpdateMockInstance(TransactionManager tm, CustomerCustomerDemo mock)
        {
            CustomerCustomerDemoTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:11,代码来源:CustomerCustomerDemoTest.cs

示例2: CreateMockInstance

        ///<summary>
        ///  Returns a Typed CustomerCustomerDemo Entity with mock values.
        ///</summary>
        public static CustomerCustomerDemo CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            CustomerCustomerDemo mock = CustomerCustomerDemoTest.CreateMockInstance_Generated(tm);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);

            // return the modified object
            return mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:15,代码来源:CustomerCustomerDemoTest.cs

示例3: UpdateMockInstance_Generated

        ///<summary>
        ///  Update the Typed CustomerCustomerDemo Entity with modified mock values.
        ///</summary>
        public static void UpdateMockInstance_Generated(TransactionManager tm, CustomerCustomerDemo mock)
        {
            //OneToOneRelationship
            CustomerDemographics mockCustomerDemographicsByCustomerTypeId = CustomerDemographicsTest.CreateMockInstance(tm);
            DataRepository.CustomerDemographicsProvider.Insert(tm, mockCustomerDemographicsByCustomerTypeId);
            mock.CustomerTypeId = mockCustomerDemographicsByCustomerTypeId.CustomerTypeId;

            //OneToOneRelationship
            Customers mockCustomersByCustomerId = CustomersTest.CreateMockInstance(tm);
            DataRepository.CustomersProvider.Insert(tm, mockCustomersByCustomerId);
            mock.CustomerId = mockCustomersByCustomerId.CustomerId;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:15,代码来源:CustomerCustomerDemoTest.generated.cs

示例4: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Region Entity with mock values.
        ///</summary>
        public static Region CreateMockInstance_Generated(TransactionManager tm)
        {
            Region mock = new Region();

            mock.RegionId = TestUtility.Instance.RandomNumber();
            mock.RegionDescription = TestUtility.Instance.RandomString(24, false);;

            // create a temporary collection and add the item to it
            TList<Region> tempMockCollection = new TList<Region>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Region)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:17,代码来源:RegionTest.generated.cs

示例5: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Categories Entity with mock values.
        ///</summary>
        public static Categories CreateMockInstance_Generated(TransactionManager tm)
        {
            Categories mock = new Categories();

            mock.CategoryName = TestUtility.Instance.RandomString(6, false);;
            mock.Description = TestUtility.Instance.RandomString(2, false);;
            mock.Picture = new byte[] { TestUtility.Instance.RandomByte() };

            // create a temporary collection and add the item to it
            TList<Categories> tempMockCollection = new TList<Categories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Categories)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:18,代码来源:CategoriesTest.generated.cs

示例6: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Orders Entity with mock values.
        ///</summary>
        public static Orders CreateMockInstance_Generated(TransactionManager tm)
        {
            Orders mock = new Orders();

            mock.OrderDate = TestUtility.Instance.RandomDateTime();
            mock.RequiredDate = TestUtility.Instance.RandomDateTime();
            mock.ShippedDate = TestUtility.Instance.RandomDateTime();
            mock.Freight = TestUtility.Instance.RandomShort();
            mock.ShipName = TestUtility.Instance.RandomString(19, false);;
            mock.ShipAddress = TestUtility.Instance.RandomString(29, false);;
            mock.ShipCity = TestUtility.Instance.RandomString(6, false);;
            mock.ShipRegion = TestUtility.Instance.RandomString(6, false);;
            mock.ShipPostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.ShipCountry = TestUtility.Instance.RandomString(6, false);;

            int count0 = 0;
            TList<Customers> _collection0 = DataRepository.CustomersProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.CustomerId = _collection0[0].CustomerId;

            }
            int count1 = 0;
            TList<Employees> _collection1 = DataRepository.EmployeesProvider.GetPaged(tm, 0, 10, out count1);
            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.EmployeeId = _collection1[0].EmployeeId;

            }
            int count2 = 0;
            TList<Shippers> _collection2 = DataRepository.ShippersProvider.GetPaged(tm, 0, 10, out count2);
            //_collection2.Shuffle();
            if (_collection2.Count > 0)
            {
                mock.ShipVia = _collection2[0].ShipperId;

            }

            // create a temporary collection and add the item to it
            TList<Orders> tempMockCollection = new TList<Orders>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Orders)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:50,代码来源:OrdersTest.generated.cs

示例7: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed CustomerCustomerDemo Entity with mock values.
        ///</summary>
        public static CustomerCustomerDemo CreateMockInstance_Generated(TransactionManager tm)
        {
            CustomerCustomerDemo mock = new CustomerCustomerDemo();

            //OneToOneRelationship
            CustomerDemographics mockCustomerDemographicsByCustomerTypeId = CustomerDemographicsTest.CreateMockInstance(tm);
            DataRepository.CustomerDemographicsProvider.Insert(tm, mockCustomerDemographicsByCustomerTypeId);
            mock.CustomerTypeId = mockCustomerDemographicsByCustomerTypeId.CustomerTypeId;
            //OneToOneRelationship
            Customers mockCustomersByCustomerId = CustomersTest.CreateMockInstance(tm);
            DataRepository.CustomersProvider.Insert(tm, mockCustomersByCustomerId);
            mock.CustomerId = mockCustomersByCustomerId.CustomerId;

            // create a temporary collection and add the item to it
            TList<CustomerCustomerDemo> tempMockCollection = new TList<CustomerCustomerDemo>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (CustomerCustomerDemo)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:23,代码来源:CustomerCustomerDemoTest.generated.cs

示例8: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Suppliers Entity with mock values.
        ///</summary>
        public static Suppliers CreateMockInstance_Generated(TransactionManager tm)
        {
            Suppliers mock = new Suppliers();

            mock.CompanyName = TestUtility.Instance.RandomString(19, false);;
            mock.ContactName = TestUtility.Instance.RandomString(14, false);;
            mock.ContactTitle = TestUtility.Instance.RandomString(14, false);;
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.Phone = TestUtility.Instance.RandomString(11, false);;
            mock.Fax = TestUtility.Instance.RandomString(11, false);;
            mock.HomePage = TestUtility.Instance.RandomString(2, false);;

            // create a temporary collection and add the item to it
            TList<Suppliers> tempMockCollection = new TList<Suppliers>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Suppliers)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:26,代码来源:SuppliersTest.generated.cs

示例9: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Territories Entity with mock values.
        ///</summary>
        public static Territories CreateMockInstance_Generated(TransactionManager tm)
        {
            Territories mock = new Territories();

            mock.TerritoryId = TestUtility.Instance.RandomString(9, false);;
            mock.TerritoryDescription = TestUtility.Instance.RandomString(24, false);;

            int count0 = 0;
            TList<Region> _collection0 = DataRepository.RegionProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.RegionId = _collection0[0].RegionId;

            }

            // create a temporary collection and add the item to it
            TList<Territories> tempMockCollection = new TList<Territories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Territories)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:26,代码来源:TerritoriesTest.generated.cs

示例10: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Employees Entity with mock values.
        ///</summary>
        public static Employees CreateMockInstance_Generated(TransactionManager tm)
        {
            Employees mock = new Employees();

            mock.LastName = TestUtility.Instance.RandomString(9, false);;
            mock.FirstName = TestUtility.Instance.RandomString(10, false);;
            mock.Title = TestUtility.Instance.RandomString(14, false);;
            mock.TitleOfCourtesy = TestUtility.Instance.RandomString(11, false);;
            mock.BirthDate = TestUtility.Instance.RandomDateTime();
            mock.HireDate = TestUtility.Instance.RandomDateTime();
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.HomePhone = TestUtility.Instance.RandomString(11, false);;
            mock.Extension = TestUtility.Instance.RandomString(4, false);;
            mock.Photo = new byte[] { TestUtility.Instance.RandomByte() };
            mock.Notes = TestUtility.Instance.RandomString(2, false);;
            mock.PhotoPath = TestUtility.Instance.RandomString(126, false);;

            int count0 = 0;
            TList<Employees> _collection0 = DataRepository.EmployeesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.ReportsTo = _collection0[0].EmployeeId;

            }

            // create a temporary collection and add the item to it
            TList<Employees> tempMockCollection = new TList<Employees>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Employees)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:40,代码来源:EmployeesTest.generated.cs

示例11: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Products Entity with mock values.
        ///</summary>
        public static Products CreateMockInstance_Generated(TransactionManager tm)
        {
            Products mock = new Products();

            mock.ProductName = TestUtility.Instance.RandomString(19, false);;
            mock.QuantityPerUnit = TestUtility.Instance.RandomString(9, false);;
            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.UnitsInStock = TestUtility.Instance.RandomShort();
            mock.UnitsOnOrder = TestUtility.Instance.RandomShort();
            mock.ReorderLevel = TestUtility.Instance.RandomShort();
            mock.Discontinued = TestUtility.Instance.RandomBoolean();

            int count0 = 0;
            TList<Categories> _collection0 = DataRepository.CategoriesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.CategoryId = _collection0[0].CategoryId;

            }
            int count1 = 0;
            TList<Suppliers> _collection1 = DataRepository.SuppliersProvider.GetPaged(tm, 0, 10, out count1);
            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.SupplierId = _collection1[0].SupplierId;

            }

            // create a temporary collection and add the item to it
            TList<Products> tempMockCollection = new TList<Products>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Products)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:39,代码来源:ProductsTest.generated.cs

示例12: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed OrderDetails Entity with mock values.
        ///</summary>
        public static OrderDetails CreateMockInstance_Generated(TransactionManager tm)
        {
            OrderDetails mock = new OrderDetails();

            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.Quantity = TestUtility.Instance.RandomShort();
            mock.Discount = (float)TestUtility.Instance.RandomNumber();

            //OneToOneRelationship
            Orders mockOrdersByOrderId = OrdersTest.CreateMockInstance(tm);
            DataRepository.OrdersProvider.Insert(tm, mockOrdersByOrderId);
            mock.OrderId = mockOrdersByOrderId.OrderId;
            //OneToOneRelationship
            Products mockProductsByProductId = ProductsTest.CreateMockInstance(tm);
            DataRepository.ProductsProvider.Insert(tm, mockProductsByProductId);
            mock.ProductId = mockProductsByProductId.ProductId;

            // create a temporary collection and add the item to it
            TList<OrderDetails> tempMockCollection = new TList<OrderDetails>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (OrderDetails)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:27,代码来源:OrderDetailsTest.generated.cs

示例13: GetAll

        /// <summary>
        /// 	Gets All rows from the DataSource.
        /// </summary>
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <param name="start">Row number at which to start reading.</param>
        /// <param name="pageLength">Number of rows to return.</param>
        /// <param name="count">out. The number of rows that match this query.</param>
        /// <remarks></remarks>
        /// <returns>Returns a typed collection of Northwind.Entities.OrderDetails objects.</returns>
        /// <exception cref="System.Exception">The command could not be executed.</exception>
        /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception>
        /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception>
        public override TList<OrderDetails> GetAll(TransactionManager transactionManager, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.sp_nt_OrderDetails_Get_List", _useStoredProcedure);

            IDataReader reader = null;

            //Create Collection
            TList<OrderDetails> rows = new TList<OrderDetails>();

            try
            {
                //Provider Data Requesting Command Event
                OnDataRequesting(new CommandEventArgs(commandWrapper, "GetAll", rows));

                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, commandWrapper);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, commandWrapper);
                }

                Fill(reader, rows, start, pageLength);
                count = -1;
                if(reader.NextResult())
                {
                    if(reader.Read())
                    {
                        count = reader.GetInt32(0);
                    }
                }

                //Provider Data Requested Command Event
                OnDataRequested(new CommandEventArgs(commandWrapper, "GetAll", rows));
            }
            finally
            {
                if (reader != null)
                    reader.Close();

                commandWrapper = null;
            }
            return rows;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:58,代码来源:SqlOrderDetailsProviderBase.generated.cs

示例14: Find

        /// <summary>
        /// 	Returns rows from the DataSource that meet the parameter conditions.
        /// </summary>
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
        /// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
        /// <param name="start">Row number at which to start reading.</param>
        /// <param name="pageLength">Number of rows to return.</param>
        /// <param name="count">out. The number of rows that match this query.</param>
        /// <returns>Returns a typed collection of Northwind.Entities.OrderDetails objects.</returns>
        public override TList<OrderDetails> Find(TransactionManager transactionManager, IFilterParameterCollection parameters, string orderBy, int start, int pageLength, out int count)
        {
            SqlFilterParameterCollection filter = null;

            if (parameters == null)
                filter = new SqlFilterParameterCollection();
            else
                filter = parameters.GetParameters();

            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.sp_nt_OrderDetails_Find_Dynamic", typeof(OrderDetailsColumn), filter, orderBy, start, pageLength);

            SqlFilterParameter param;

            for ( int i = 0; i < filter.Count; i++ )
            {
                param = filter[i];
                database.AddInParameter(commandWrapper, param.Name, param.DbType, param.GetValue());
            }

            TList<OrderDetails> rows = new TList<OrderDetails>();
            IDataReader reader = null;

            try
            {
                //Provider Data Requesting Command Event
                OnDataRequesting(new CommandEventArgs(commandWrapper, "Find", rows));

                if ( transactionManager != null )
                {
                    reader = Utility.ExecuteReader(transactionManager, commandWrapper);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, commandWrapper);
                }

                Fill(reader, rows, 0, int.MaxValue);
                count = rows.Count;

                if ( reader.NextResult() )
                {
                    if ( reader.Read() )
                    {
                        count = reader.GetInt32(0);
                    }
                }

                //Provider Data Requested Command Event
                OnDataRequested(new CommandEventArgs(commandWrapper, "Find", rows));
            }
            finally
            {
                if ( reader != null )
                    reader.Close();

                commandWrapper = null;
            }

            return rows;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:71,代码来源:SqlOrderDetailsProviderBase.generated.cs

示例15: Delete

        /// <summary>
        /// 	Deletes a row from the DataSource.
        /// </summary>
        /// <param name="_orderId">. Primary Key.</param>	
        /// <param name="_productId">. Primary Key.</param>	
        /// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
        /// <remarks>Deletes based on primary key(s).</remarks>
        /// <returns>Returns true if operation suceeded.</returns>
        /// <exception cref="System.Exception">The command could not be executed.</exception>
        /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception>
        /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception>
        public override bool Delete(TransactionManager transactionManager, System.Int32 _orderId, System.Int32 _productId)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.sp_nt_OrderDetails_Delete", _useStoredProcedure);
            database.AddInParameter(commandWrapper, "@OrderId", DbType.Int32, _orderId);
            database.AddInParameter(commandWrapper, "@ProductId", DbType.Int32, _productId);

            //Provider Data Requesting Command Event
            OnDataRequesting(new CommandEventArgs(commandWrapper, "Delete"));

            int results = 0;

            if (transactionManager != null)
            {
                results = Utility.ExecuteNonQuery(transactionManager, commandWrapper);
            }
            else
            {
                results = Utility.ExecuteNonQuery(database,commandWrapper);
            }

            //Stop Tracking Now that it has been updated and persisted.
            if (DataRepository.Provider.EnableEntityTracking)
            {
                string entityKey = EntityLocator.ConstructKeyFromPkItems(typeof(OrderDetails)
                    ,_orderId,_productId);
                EntityManager.StopTracking(entityKey);

            }

            //Provider Data Requested Command Event
            OnDataRequested(new CommandEventArgs(commandWrapper, "Delete"));

            commandWrapper = null;

            return Convert.ToBoolean(results);
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:48,代码来源:SqlOrderDetailsProviderBase.generated.cs


注:本文中的Northwind.Data.TransactionManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。