///<summary> /// Returns a Typed ProductSalesFor1997 Entity with mock values. ///</summary> public static ProductSalesFor1997 CreateMockInstance() { ProductSalesFor1997 mock = new ProductSalesFor1997(); mock.CategoryName = TestUtility.Instance.RandomString(6, false);; mock.ProductName = TestUtility.Instance.RandomString(19, false);; mock.ProductSales = TestUtility.Instance.RandomShort(); return (ProductSalesFor1997)mock; }
/// <summary> /// Deserialize the mock ProductSalesFor1997 entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_ProductSalesFor1997.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(ProductSalesFor1997)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (ProductSalesFor1997) mySerializer.Deserialize(myFileStream); myFileStream.Close(); System.IO.File.Delete(fileName); System.Console.WriteLine("mock correctly deserialized from a temporary file."); }
/// <summary> /// Gets the property value by name. /// </summary> /// <param name="entity">The entity.</param> /// <param name="propertyName">Name of the property.</param> /// <returns></returns> public static object GetPropertyValueByName(ProductSalesFor1997 entity, string propertyName) { switch (propertyName) { case "CategoryName": return entity.CategoryName; case "ProductName": return entity.ProductName; case "ProductSales": return entity.ProductSales; } return null; }
///<summary> /// Returns a Typed ProductSalesFor1997Base Entity ///</summary> public virtual ProductSalesFor1997Base Copy() { //shallow copy entity ProductSalesFor1997 copy = new ProductSalesFor1997(); copy.CategoryName = this.CategoryName; copy.ProductName = this.ProductName; copy.ProductSales = this.ProductSales; copy.AcceptChanges(); return (ProductSalesFor1997)copy; }
///<summary> /// A simple factory method to create a new <see cref="ProductSalesFor1997"/> instance. ///</summary> ///<param name="_categoryName"></param> ///<param name="_productName"></param> ///<param name="_productSales"></param> public static ProductSalesFor1997 CreateProductSalesFor1997(System.String _categoryName, System.String _productName, System.Decimal? _productSales) { ProductSalesFor1997 newProductSalesFor1997 = new ProductSalesFor1997(); newProductSalesFor1997.CategoryName = _categoryName; newProductSalesFor1997.ProductName = _productName; newProductSalesFor1997.ProductSales = _productSales; return newProductSalesFor1997; }