public static void runOneGarbageRead(Resources context, string filePath, TestType testType, TestWorkload testWorkload, SalesValues salesValues) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderNumber == salesValues.SalesId) .Where(x => x.OrderingCustomerAccountNumber == salesValues.CustAccount) .Where(x => x.CustomersOrderReference == salesValues.PurchOrderFormNum) .Where(x => x.SalesOrderStatus == (Microsoft.Dynamics.DataEntities.SalesStatus)salesValues.SalesStatus) //.Where(x => x.OrderCreationDateTime >= salesValues.CreatedDateTime.AddDays(-1)) .Where(x => x.Email == salesValues.Email) .Where(x => x.DefaultShippingSiteId == salesValues.InventSiteId) .Where(x => x.DefaultShippingWarehouseId == salesValues.InventLocationid) .Where(x => x.SalesOrderName == salesValues.SalesName) .Where(x => x.dataAreaId == salesValues.DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static string runOneReadThread(Resources context, int threadCount, string filePath, TestType testType, TestWorkload testWorkload, string SalesOrderNumber, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderNumber == SalesOrderNumber && x.dataAreaId == DataAreaId).First(); sw.Stop(); return(Entity + "," + threadCount + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); }
public static void createAndDeleteWithCompoundEntity(Resources context, string filePath, TestType testType, TestWorkload testWorkload, string DataAreaId, string customerAccount) { Stopwatch sw = new Stopwatch(); string SalesOrderNumber; Entity = "salesOrderHeaderV2"; DataServiceCollection <SalesOrderHeaderV2> SalesOrderCollection = new DataServiceCollection <SalesOrderHeaderV2>(context); SalesOrderHeaderV2 salesOrderHeaderV2 = new SalesOrderHeaderV2(); SalesOrderCollection.Add(salesOrderHeaderV2); // Required Fields salesOrderHeaderV2.OrderingCustomerAccountNumber = customerAccount; salesOrderHeaderV2.InvoiceCustomerAccountNumber = customerAccount; salesOrderHeaderV2.dataAreaId = DataAreaId; salesOrderHeaderV2.CurrencyCode = "USD"; salesOrderHeaderV2.LanguageId = "en-us"; context.SaveChanges(SaveChangesOptions.PostOnlySetProperties | SaveChangesOptions.BatchWithSingleChangeset); SalesOrderNumber = salesOrderHeaderV2.SalesOrderNumber; context.SalesOrderHeadersV2.FirstOrDefault(); salesOrderHeaderV2 = null; sw.Start(); salesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderNumber == SalesOrderNumber && x.dataAreaId == DataAreaId).First(); context.DeleteObject(salesOrderHeaderV2); context.SaveChanges(SaveChangesOptions.PostOnlySetProperties | SaveChangesOptions.BatchWithSingleChangeset); sw.Stop(); Console.WriteLine("Created and Deleted Sales Order " + SalesOrderNumber); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void runOneReadOnSalesEmail(Resources context, string filePath, TestType testType, TestWorkload testWorkload, string SalesEmail, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.Email == SalesEmail && x.dataAreaId == DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void runOneSalesTypeIdxRead(Resources context, string filePath, TestType testType, TestWorkload testWorkload, string SalesId, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); //entity already has a filter on salesType of Sales SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderNumber == SalesId) .Where(x => x.dataAreaId == DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void runOneStatusCustAccountIdxRead(Resources context, string filePath, TestType testType, TestWorkload testWorkload, int SalesStatus, string CustAccount, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderStatus == (Microsoft.Dynamics.DataEntities.SalesStatus)SalesStatus) .Where(x => x.OrderingCustomerAccountNumber == CustAccount) .Where(x => x.dataAreaId == DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void runOneCustCreatedDateIdxRead(Resources context, string filePath, TestType testType, TestWorkload testWorkload, string CustAccount, DateTimeOffset CreatedDateTime, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.OrderingCustomerAccountNumber == CustAccount) .Where(x => x.OrderCreationDateTime >= CreatedDateTime.AddDays(-1)) .Where(x => x.dataAreaId == DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void runOneCustIdxRead(Resources context, string filePath, TestType testType, TestWorkload testWorkload, String CustAccount, string SalesOrderNumber, String PurchOrderFormNum, string DataAreaId) { Stopwatch sw = new Stopwatch(); sw.Start(); SalesOrderHeaderV2 SalesOrderHeaderV2 = context.SalesOrderHeadersV2.Where(x => x.SalesOrderNumber == SalesOrderNumber) .Where(x => x.OrderingCustomerAccountNumber == CustAccount) .Where(x => x.CustomersOrderReference == PurchOrderFormNum) .Where(x => x.dataAreaId == DataAreaId).First(); sw.Stop(); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }
public static void createWithCompoundEntityMaximum(Resources context, string filePath, TestType testType, TestWorkload testWorkload, string DataAreaId, string customerAccount) { Stopwatch sw = new Stopwatch(); sw.Start(); DataServiceCollection <SalesOrderHeaderV2> SalesOrderCollection = new DataServiceCollection <SalesOrderHeaderV2>(context); SalesOrderHeaderV2 salesOrderHeaderV2 = new SalesOrderHeaderV2(); SalesOrderCollection.Add(salesOrderHeaderV2); // Required Fields salesOrderHeaderV2.OrderingCustomerAccountNumber = customerAccount; salesOrderHeaderV2.InvoiceCustomerAccountNumber = customerAccount; salesOrderHeaderV2.dataAreaId = DataAreaId; salesOrderHeaderV2.CurrencyCode = "USD"; salesOrderHeaderV2.LanguageId = "en-us"; // Optional Fields salesOrderHeaderV2.SalesOrderPromisingMethod = SalesDeliveryDateControlType.CTP; salesOrderHeaderV2.DeliveryModeCode = "10"; salesOrderHeaderV2.DeliveryTermsCode = "FOB"; salesOrderHeaderV2.PaymentTermsName = "Net10"; salesOrderHeaderV2.CustomerPaymentMethodName = "Check"; salesOrderHeaderV2.Email = "*****@*****.**"; salesOrderHeaderV2.CustomerPostingProfileId = "GEN"; salesOrderHeaderV2.SalesOrderName = "Test Sales Order Id"; salesOrderHeaderV2.SalesOrderOriginCode = "PHONE"; salesOrderHeaderV2.SalesOrderPoolId = "03"; salesOrderHeaderV2.SalesTaxGroupCode = "CA"; salesOrderHeaderV2.TaxExemptNumber = "35-12345"; salesOrderHeaderV2.OrderResponsiblePersonnelNumber = "000002"; salesOrderHeaderV2.OrderTakerPersonnelNumber = "000002"; salesOrderHeaderV2.DefaultLedgerDimensionDisplayValue = "001--"; salesOrderHeaderV2.DeliveryAddressCity = "Detroit"; salesOrderHeaderV2.DeliveryAddressCountryRegionISOCode = "USA"; salesOrderHeaderV2.DeliveryAddressDescription = "Delivery"; salesOrderHeaderV2.DeliveryAddressName = "Delivery"; salesOrderHeaderV2.DeliveryAddressStateId = "MI"; salesOrderHeaderV2.DeliveryAddressStreet = "123 Main St"; salesOrderHeaderV2.DeliveryAddressZipCode = "01234"; context.SaveChanges(SaveChangesOptions.PostOnlySetProperties | SaveChangesOptions.BatchWithSingleChangeset); sw.Stop(); Console.WriteLine("Created Sales Order " + salesOrderHeaderV2.SalesOrderNumber); StreamWriter stream = File.AppendText(filePath); stream.WriteLine(Entity + "," + testType + "," + testWorkload + "," + sw.Elapsed.TotalMilliseconds.ToString()); stream.Flush(); stream.Close(); }