IgnoreResouceNotFoundExceptionImpl( bool ignoreResouceNotFoundException) { StashClient <KeyDataExplicit> clientWithExtra = null; KeyDataExplicit dataWritten = null; try { clientWithExtra = StashConfiguration.GetClient <KeyDataExplicit>(); clientWithExtra.CreateTableIfNotExist(); var clientMin = StashConfiguration.GetClient <KeyDataExplicit>( new StashClientOptions { IgnoreResourceNotFoundException = ignoreResouceNotFoundException, OverrideEntitySetName = instance => typeof(KeyDataExplicit).Name, OverrideEntitySetNameIsDynamic = false, }); dataWritten = new KeyDataExplicit { PartitionKey = "ResourceNotFound", RowKey = Guid.NewGuid().ToString() }; clientWithExtra.Insert(dataWritten); var dataRead = clientMin.Get( dataWritten.PartitionKey, dataWritten.RowKey + "X"); // we should reach here only if ignoreResouceNotFoundException is true Assert.IsTrue(ignoreResouceNotFoundException); Assert.IsTrue(dataRead == null); } catch (StashException stashEx) { Assert.IsTrue( !ignoreResouceNotFoundException && stashEx.Error == StashError.UnexpectedRuntime); } catch (Exception ex) { Assert.Fail(); } clientWithExtra.Delete(dataWritten); }
MissingMembersInTypeImpl( bool ignoreMissingProperties) { StashClient <MissingMembersInType> clientWithExtra = null; MissingMembersInType dataWritten = null; try { clientWithExtra = StashConfiguration.GetClient <MissingMembersInType>(); clientWithExtra.CreateTableIfNotExist(); var clientMin = StashConfiguration.GetClient <KeyDataExplicit>( new StashClientOptions { IgnoreMissingProperties = ignoreMissingProperties, OverrideEntitySetName = instance => typeof(MissingMembersInType).Name, OverrideEntitySetNameIsDynamic = false, }); dataWritten = new MissingMembersInType { PartitionKey = "MissingMember", RowKey = Guid.NewGuid().ToString(), Int0 = 0, Int1 = 1, Int2 = 2 }; clientWithExtra.Insert(dataWritten); var dataRead = clientMin.Get(dataWritten.PartitionKey, dataWritten.RowKey); // we should reach here only if ignoring missing properties Assert.IsTrue(ignoreMissingProperties); } catch (StashException stashEx) { Assert.IsTrue( !ignoreMissingProperties && stashEx.Error == StashError.MissingMembersInType); } catch (Exception ex) { Assert.Fail(); } clientWithExtra.Delete(dataWritten); }
Write <T>( StashClient <T> client, DataSize dataSize) where T : IDataHelper <T>, new() { T data = TypeFactory <T> .Create(dataSize); data = client.Insert(data); // etag not present in type or has a valid etag Assert.IsTrue(!data.HasETag() || data.GetETag().Is()); return(data); }
DoWhiteSpaceInKeys() { StashClient <WhiteSpacesInData> client = StashConfiguration.GetClient <WhiteSpacesInData>(); client.CreateTableIfNotExist(); const string partitionKey = " " + _partitionKey; // prefix string rowKey = Guid.NewGuid().ToString() + " "; // suffix const string stringField = " "; const string stringField2 = " X "; client.Insert( new WhiteSpacesInData { PartitionKey = partitionKey, RowKey = rowKey, StringField = stringField, StringField2 = stringField2 }); var data = client .CreateQuery() .Where(x => x.PartitionKey == partitionKey && x.RowKey == rowKey) .FirstOrDefault(); data = client .CreateQuery() .FirstOrDefault(x => x.PartitionKey == partitionKey && x.RowKey == rowKey); Assert.IsTrue(data != null); Assert.IsTrue(data.PartitionKey == partitionKey); Assert.IsTrue(data.RowKey == rowKey); Assert.IsTrue(data.StringField == ""); Assert.IsTrue(data.StringField2 == stringField2); client.Delete(data); }
AllDataWithDictionaryMultiple( StashClientOptions options) { StashClient <AllDataWithDictionary> client = StashConfiguration.GetClient <AllDataWithDictionary>(options); AllDataWithDictionary entity = TypeFactory <AllDataWithDictionary> .Create(DataSize.Multiple); // DataSize.Multiple client.Insert(entity); AllDataWithDictionary entityRead = client.Get(entity.PartitionKey, entity.RowKey); Assert.IsTrue(entityRead.Equals(entity)); return(entityRead); }
GetClientWithPopulate( Guid pKey, int count) { StashClient <KeyDataExplicit> client = StashConfiguration.GetClient <KeyDataExplicit>(); client.CreateTableIfNotExist(); while (count-- > 0) { client.Insert( new KeyDataExplicit { PartitionKey = pKey.ToString(), RowKey = Guid.NewGuid().ToString() }); } return(client); }
Tutorial_09_CompositeKeys() { //---------------------------------------------------------------------------------------------------------- // Create Stash Client StashClient <EmployeeCompensation> client = StashConfiguration.GetClient <EmployeeCompensation>(); client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Populate the table with 10 years of salary information int nbrOfYears = 10; DateTime today = DateTime.Now.ToUniversalTime(); DateTime hireDate = today.AddYears(-nbrOfYears); Guid employeeId = Guid.NewGuid(); // Insert 10 years of data, such that each year the salary goes up by 5000. for (int yr = 0; yr < nbrOfYears; ++yr) { client.Insert( new EmployeeCompensation { EmployeeId = employeeId, CompDate = new CompensationEvent { CompensationType = CompensatationTypeValue.Salary, Date = hireDate.AddYears(yr) }, Amount = 65000 + (yr * 5000) }); } //---------------------------------------------------------------------------------------------------------- // Populate the table with the last 12 months of commission information int nbrOfMths = 12; // Insert 12 months of data, such that each year the commission goes up by 50. for (int mth = 0; mth < nbrOfMths; ++mth) { client.Insert( new EmployeeCompensation { EmployeeId = employeeId, CompDate = new CompensationEvent { CompensationType = CompensatationTypeValue.Commission, Date = today.AddMonths(-mth) }, Amount = 1000 + (mth * 50) }); } //---------------------------------------------------------------------------------------------------------- // Get the last salary EmployeeCompensation employeeCompensation = client .CreateQuery() .Where(e => e.EmployeeId == employeeId && e.CompDate == new CompensationEvent { CompensationType = CompensatationTypeValue.Salary }) // no need to specify the latest date, we get the first row, which // has the latest date. .Take(1) // first row .FirstOrDefault(); // verify we got the last date and last salary amount Assert.IsTrue(employeeCompensation.CompDate.Date.Date == hireDate.Date.AddYears((nbrOfYears - 1))); Assert.IsTrue(employeeCompensation.Amount == 65000 + ((nbrOfYears - 1) * 5000)); // How does this work? // Stash converts the "Compensation Type == 'S'" into // "RowKey >= 'S' and RowKey < 'T'" and asks to only return the first one (Take(1)) // In this case the last dated event is the first row, since the date is morphed // to the number of days before an arbitrary end date, such that the morphed date is // effectively in reverse order //---------------------------------------------------------------------------------------------------------- // Get all the commissions List <EmployeeCompensation> commissions = client .CreateQuery() .Where(e => e.EmployeeId == employeeId && e.CompDate == new CompensationEvent { CompensationType = CompensatationTypeValue.Commission }) // no need to specify the date, we get all the commissions // for the employee because again the query mapped the '==' to a range '>= and <'. .ToList(); Assert.IsTrue(commissions.Count == nbrOfMths); //---------------------------------------------------------------------------------------------------------- // Get commissions for the 4 months, prior to the last 4 months commissions = client .CreateQuery() .Where(e => e.EmployeeId == employeeId && e.CompDate >= new CompensationEvent { CompensationType = CompensatationTypeValue.Commission, Date = today.AddDays(-5).AddMonths(-8) } && e.CompDate <= new CompensationEvent { CompensationType = CompensatationTypeValue.Commission, Date = today.AddDays(-5).AddMonths(-4) } ) .ToList(); Assert.IsTrue(commissions.Count == 4); // How does this work? // Stash converts the query from a '>= X && < Y' to // < X && >= Y because the morpher indicated that 'IsCollationEquivalent' was false. // otherwise this query would have returned no rows because the range is inverted. //---------------------------------------------------------------------------------------------------------- }
Tutorial_06_Collections() { //---------------------------------------------------------------------------------------------------------- // Create a Stash Client StashClient <EmployeeSkills> client = StashConfiguration.GetClient <EmployeeSkills>(); client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Lets create an instance of the class we what to 'stash' const string departmentDev = "Dev"; const string ssn = "123456789"; EmployeeSkills dataWritten = new EmployeeSkills { Department = departmentDev, EmployeeId = Guid.NewGuid().ToString(), Name = "John Doe", SkillLevel = 8, DateOfBirth = new DateTime(1990, 1, 1), SSN = ssn, Salutation = Salutation.Ms }; // update the private field dataWritten.SetAnnualSalary(); // Populate Languages, certification and salary history dataWritten.Languages = new List <ProgramingLanguages> { ProgramingLanguages.Assembly, ProgramingLanguages.VisualBasic }; const string cert0 = "MSSQL", cert1 = "MSCPP", cert2 = "MSRP"; dataWritten.Certifications = new ArrayList { cert0, cert1, cert2 }; dataWritten.SalaryHistory = new SalaryInfo[] { new SalaryInfo { DateStart = new DateTime(2009, 1, 1), DateEnd = new DateTime(2010, 1, 1), Salary = 100000 }, new SalaryInfo { DateStart = new DateTime(2010, 1, 1), DateEnd = new DateTime(2012, 1, 1), Salary = 110000 }, }; dataWritten.MysteryNumbers = new int[] { 3, 2, 1, 0 }; //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data EmployeeSkills dataRead = client.Get(dataWritten.Department, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // Verify exactly what was written to table storage by using the Generic Pool class we wrote // earlier. // set this up to target the correct table storage entity set StashClient <GenericPool> clientGenericPool = StashConfiguration.GetClient <GenericPool>( new StashClientOptions { OverrideEntitySetName = o => "EmployeeSkills", OverrideEntitySetNameIsDynamic = false, Feedback = StashConfiguration.TraceFeedback, }); GenericPool dataPool = clientGenericPool.Get( dataRead.Department, dataRead.EmployeeId); // All collection items are suffixed with the index base 0, in the format "_000". // Because the "_" is used for demarcating collection indexes, explicit defined members are not allowed // to have the embedded "_" character in the table property name. // Test for languages Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "Languages_000" && ((ProgramingLanguages)kv.Value == ProgramingLanguages.Assembly)).ToList().Count == 1); Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "Languages_001" && ((ProgramingLanguages)kv.Value == ProgramingLanguages.VisualBasic)).ToList().Count == 1); // Test for certification Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "Certifications_000" && ((string)kv.Value == cert0)).ToList().Count == 1); Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "Certifications_001" && ((string)kv.Value == cert1)).ToList().Count == 1); Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "Certifications_002" && ((string)kv.Value == cert2)).ToList().Count == 1); // Test salary history - key only Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "SalaryHistory_000").ToList().Count == 1); Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "SalaryHistory_001").ToList().Count == 1); // Mystery numbers ... well they were persisted using the DataContract Serializer // and persisted as XML as a single table property. Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key == "MysteryNumbers").ToList().Count == 1); //---------------------------------------------------------------------------------------------------------- // now delete the entity client.Delete( departmentDev, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.Department == dataWritten.Department && imp.EmployeeId == dataWritten.EmployeeId select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_01_Implicit_JobApplicant() { //---------------------------------------------------------------------------------------------------------- // Create the Stash Client. // Our helper class offers various flavors of this. StashClient <JobApplicant> client = StashConfiguration.GetClient <JobApplicant>(); //---------------------------------------------------------------------------------------------------------- // Create the corresponding table or confirm that it exists // The table name can be inferred using various methods. In this case it is inferred from the class name, // 'JobApplicant'. client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Create an instance of the class we want to Stash JobApplicant dataWritten = new JobApplicant { PartitionKey = "A", RowKey = Guid.NewGuid().ToString(), Name = "John Doe", Skill_Level = 1 }; //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data, using the partition and row key, no need to use LINQ here. JobApplicant dataRead = client.Get(dataWritten.PartitionKey, dataWritten.RowKey); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // Lets change the SkillLevel and Update dataWritten.Skill_Level += 1; client.Update(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data but this time lets use LINQ dataRead = client.CreateQuery() .Where(imp => imp.PartitionKey == dataWritten.PartitionKey && imp.RowKey == dataWritten.RowKey) .FirstOrDefault(); //---------------------------------------------------------------------------------------------------------- // Again verify that we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // now delete the entity client.Delete(dataWritten); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.PartitionKey == dataWritten.PartitionKey && imp.RowKey == dataWritten.RowKey select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_03_Explicit_Employee() { //---------------------------------------------------------------------------------------------------------- // Create the Stash Client. StashClient <Employee> client = StashConfiguration.GetClient <Employee>(); //---------------------------------------------------------------------------------------------------------- // Create the underlying table if it does not already exists client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Create an instance of the class const string departmentDev = "Dev"; Employee dataWritten = new Employee { Department = departmentDev, EmployeeId = Guid.NewGuid().ToString(), Name = "John Doe", SkillLevel = 8, DateOfBirth = new DateTime(1990, 1, 1) }; // update the private field dataWritten.SetAnnualSalary(); //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); // Note: On inserts, updates and merges, the ETag is overwritten from the ETag returned to keep the data // in sync. //---------------------------------------------------------------------------------------------------------- // And read it back Employee dataRead = client.Get(dataWritten.Department, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); // Verify that the 2 ETags are identical Assert.IsTrue(dataRead.ETagInternal == dataWritten.ETagInternal); //---------------------------------------------------------------------------------------------------------- // Change the Skill level and update the Stash dataWritten.SkillLevel += 1; dataWritten.SetAnnualSalary(); client.Update(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data but this time lets use LINQ Employee dataReadUpdated = client.CreateQuery() .Where(imp => imp.Department == departmentDev && imp.EmployeeId == dataWritten.EmployeeId) .FirstOrDefault(); //---------------------------------------------------------------------------------------------------------- // Again verify that we got back what we put in Assert.IsTrue(dataWritten.Equals(dataReadUpdated)); // Verify that the 2 ETags are identical Assert.IsTrue(dataWritten.ETagInternal == dataReadUpdated.ETagInternal); //---------------------------------------------------------------------------------------------------------- // now attempt to update the data read the first time around // this should fail and throw an exception since the data was updated since the row was last read and // so has a stale ETag. // Uses the implied update mode here by default. That is, if the StashETag attribute is applied to a // member in the class, implies ETag must match, bool isSuccess; try { client.Update(dataRead); isSuccess = false; } catch (Exception ex) { Assert.IsTrue((ex as StashException).Error == StashError.ETagMatchFailed); isSuccess = true; } Assert.IsTrue(isSuccess); //---------------------------------------------------------------------------------------------------------- // attempt to update it again but this time ignore ETag matching. This should succeed. // and dataRead has the latest ETag client.UpdateUnconditional(dataRead); //---------------------------------------------------------------------------------------------------------- // now attempt to delete the entity using the data written entity // this should fail and throw an exception since the data was recently updated and so has a new ETag // Uses the implied update mode here by default. That is, if the StashETag attribute is applied to a // member in the class, implies ETag must match, try { client.Delete(dataReadUpdated); isSuccess = false; } catch (Exception ex) { Assert.IsTrue((ex as StashException).Error == StashError.ETagMatchFailed); isSuccess = true; } Assert.IsTrue(isSuccess); //---------------------------------------------------------------------------------------------------------- // now delete the entity unconditionally without the need for ETag Matching. // Can instead also use client.DeleteUnconditional here too. client.Delete(dataRead, ETagMatch.Unconditional); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.Department == dataWritten.Department && imp.EmployeeId == dataWritten.EmployeeId select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // Essentially the ETag gist is this. // Define and decorate a member in your type with an ETag if you want to optimistic concurrency support. // Stash will keep you ETag in sync across inserts, updates and merges. // There are multiple ways to implicitly override ETag matching if that is what is wanted. // The implicit way to disable optimistic concurrency support is not to define an ETag member. //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_04_DictionaryPool() { //---------------------------------------------------------------------------------------------------------- // Create a Stash Client for the Employee class StashClient <Employee> clientEmployee = StashConfiguration.GetClient <Employee>(); clientEmployee.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Create an StashClient for the generic pool class, // Since we want to read and write to the Employee table, notice how we setup the correct EntityName in // the StashClientOptions. Otherwise the azure table implied would be "GenericPool". // // The call back method of naming the table has flexible capabilities. It can be used to determine // the table name dynamically based on the data in the object instance. // In this case it is used statically and called only once. StashClient <GenericPool> clientGenericPool = StashConfiguration.GetClient <GenericPool>( new StashClientOptions { OverrideEntitySetName = o => "Employee", OverrideEntitySetNameIsDynamic = false, Feedback = StashConfiguration.TraceFeedback, }); //---------------------------------------------------------------------------------------------------------- // Stash an Employee const string departmentDev = "Dev"; Employee dataEmployee = new Employee { Department = departmentDev, EmployeeId = Guid.NewGuid().ToString(), Name = "John Doe", SkillLevel = 8, DateOfBirth = new DateTime(1990, 1, 1) }; dataEmployee.SetAnnualSalary(); clientEmployee.Insert(dataEmployee); //---------------------------------------------------------------------------------------------------------- // and read it back thru the GenericPool GenericPool dataPool = clientGenericPool.Get( dataEmployee.Department, dataEmployee.EmployeeId); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in via the Employee type. Assert.IsTrue( dataPool.PrimaryKey == dataEmployee.Department && dataPool.SecondaryKey == dataEmployee.EmployeeId && dataPool.Pool["AnnualSalary"].Equals(dataEmployee.GetAnnualSalary()) && dataPool.Pool["Birthday"].Equals(dataEmployee.DateOfBirth) && dataPool.Pool["SkillLevel"].Equals(dataEmployee.SkillLevel) && dataPool.Pool["Name"].Equals(dataEmployee.Name) && dataPool.Pool.Count == 4 + 1); // + 1 to the ETag //---------------------------------------------------------------------------------------------------------- // Make a few changes and update dataPool.Pool["Name"] = "Lucifure"; // name change dataPool.Pool["Unique"] = Guid.NewGuid(); // new field clientGenericPool.Update(dataPool); // Note: Updates, Merges etc keep the original objects in sync with the latest ETags. // Even if an ETag is not specified for the type, if the type supports a Pool, // the ETag is maintained and synched in the pool //---------------------------------------------------------------------------------------------------------- // Read back the data GenericPool dataPoolRead = clientGenericPool.CreateQuery() .Where(imp => imp.PrimaryKey == dataEmployee.Department && imp.SecondaryKey == dataEmployee.EmployeeId) .FirstOrDefault(); //---------------------------------------------------------------------------------------------------------- // and verify that we got back what we put in Assert.IsTrue( dataPool.PrimaryKey == dataPoolRead.PrimaryKey && dataPool.SecondaryKey == dataPoolRead.SecondaryKey && StashHelper.DictionaryEquals( dataPool.Pool, dataPoolRead.Pool)); //---------------------------------------------------------------------------------------------------------- // Merge can be performed very efficiently with a StashPool. Only include the tables properties // to be merge in the dictionary. No need to null out members or defined nullable value type members. // Create a new pool with just the objects of interest Dictionary <string, object> pool = new Dictionary <string, object>(); // save the current etag (for now and later) string etagPreMerge = dataPoolRead.Pool[Literal.ETag].ToString(); pool["Name"] = "Stash"; // new value to merge pool[Literal.ETag] = etagPreMerge; // get the ETag too // create a new pool object for merging. GenericPool dataPoolMerged = new GenericPool { PrimaryKey = dataPoolRead.PrimaryKey, SecondaryKey = dataPoolRead.SecondaryKey, Pool = pool }; clientGenericPool.Merge(dataPoolMerged, ETagMatch.Must); // force ETag matching. // read back and verify GenericPool dataPoolMergedRead = clientGenericPool.Get( dataPoolMerged.PrimaryKey, dataPoolMerged.SecondaryKey); // validate Assert.IsTrue(dataPoolMergedRead.Pool.Count == dataPoolRead.Pool.Count && dataPoolMergedRead.Pool["Name"] as String == "Stash"); //---------------------------------------------------------------------------------------------------------- // attempt to merge again, replacing the current ETag with the old one. bool isSuccess; try { // use the defunct etag to exhibit this dataPoolMerged.Pool[Literal.ETag] = etagPreMerge; clientGenericPool.Merge(dataPoolMerged); isSuccess = false; } catch (Exception ex) { // Merge fails because the ETag was old and did not match. Assert.IsTrue((ex as StashException).Error == StashError.ETagMatchFailed); isSuccess = true; } Assert.IsTrue(isSuccess); //---------------------------------------------------------------------------------------------------------- // attempt to merge yet again, this time by disabling ETag matching. clientGenericPool.Merge(dataPoolMerged, ETagMatch.Unconditional); //---------------------------------------------------------------------------------------------------------- // now attempt to delete the entity try { clientGenericPool.Delete(dataPoolMergedRead); // Implicit ETag matching, will make this fail too // because the last update changed the ETag isSuccess = false; } catch (Exception ex) { Assert.IsTrue((ex as StashException).Error == StashError.ETagMatchFailed); isSuccess = true; } Assert.IsTrue(isSuccess); //---------------------------------------------------------------------------------------------------------- // Do an unconditional delete clientGenericPool.DeleteUnconditional(dataPoolMergedRead); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from emp in clientEmployee.CreateQuery() where emp.Department == dataEmployee.Department && emp.EmployeeId == dataEmployee.EmployeeId select emp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_07_LargeData() { //---------------------------------------------------------------------------------------------------------- // Create Stash Client StashClient <EmployeeResume> client = StashConfiguration.GetClient <EmployeeResume>(); client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Lets create an instance of the class we what to 'stash' const string departmentDev = "Dev"; EmployeeResume dataWritten = new EmployeeResume { Department = departmentDev, EmployeeId = Guid.NewGuid().ToString(), // 1 char = 2 bytes so this random string is 2.5 time the size of a table property Text = BuildString((int)(32 * 1024 * 2.5)), // almost 2 time the size of a table property Photograph = new byte[(int)(64 * 1024 * 1.9)], }; // generate random bytes for the photograph (new Random()).NextBytes(dataWritten.Photograph); //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data EmployeeResume dataRead = client.Get(dataWritten.Department, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // Verify exactly what was written to table storage by using the Generic Pool class we wrote // earlier. // set this up to target the correct table storage entity set StashClient <GenericPool> clientGenericPool = StashConfiguration.GetClient <GenericPool>( new StashClientOptions { OverrideEntitySetName = o => typeof(EmployeeResume).Name, OverrideEntitySetNameIsDynamic = false, Feedback = StashConfiguration.TraceFeedback, }); GenericPool dataPool = clientGenericPool.Get( dataRead.Department, dataRead.EmployeeId); // All split items are suffixed with the index base A, in the format "_A". // Because the "_" is used for demarcating collection indexes, explicit defined members are not allowed // to have the embedded "_" character in the table property name. // Test for Text Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key.IndexOf("Text_") == 0).ToList().Count == 3); Assert.IsTrue( dataPool.Pool.Where( kv => kv.Key.IndexOf("Photograph_") == 0).ToList().Count == 2); //---------------------------------------------------------------------------------------------------------- // now delete the entity client.Delete( departmentDev, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.Department == dataWritten.Department && imp.EmployeeId == dataWritten.EmployeeId select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_05_Morphing_EmployeeInfo() { //---------------------------------------------------------------------------------------------------------- // Create a Stash Client StashClient <EmployeeInfo> client = StashConfiguration.GetClient <EmployeeInfo>(); client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Create an instance of the class we what to Stash const string departmentDev = "Dev"; const string ssn = "123456789"; EmployeeInfo dataWritten = new EmployeeInfo { Department = departmentDev, EmployeeId = Guid.NewGuid().ToString(), Name = "John Doe", SkillLevel = 8, DateOfBirth = new DateTime(1990, 1, 1), SSN = ssn, Salutation = Salutation.Dr }; // update the private field dataWritten.SetAnnualSalary(); //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data EmployeeInfo dataRead = client.Get(dataWritten.Department, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // Now let us verify exactly what was written to table storage by using the Generic Pool class we wrote // earlier. // set this up to target the correct table storage entity set StashClient <GenericPool> clientGenericPool = StashConfiguration.GetClient <GenericPool>( new StashClientOptions { OverrideEntitySetName = o => "EmployeeInfo", OverrideEntitySetNameIsDynamic = false, Feedback = StashConfiguration.TraceFeedback, }); GenericPool dataPool = clientGenericPool.Get( dataRead.Department, dataRead.EmployeeId); // validate that the SSN value got morphed in to a byte[] Assert.IsTrue(dataPool.Pool["SSN"].GetType() == typeof(byte[])); //---------------------------------------------------------------------------------------------------------- // Change the Skill level and update the Stash dataWritten.SkillLevel += 1; dataWritten.SetAnnualSalary(); // force an unconditional update since, dataWritten does not have a ETag. // Optionally copy over the ETag from dataRead. client.Update(dataWritten, ETagMatch.Unconditional); //---------------------------------------------------------------------------------------------------------- // Read back the data but this time lets use LINQ dataRead = client.CreateQuery() .Where(imp => imp.Department == departmentDev && imp.EmployeeId == dataWritten.EmployeeId) .FirstOrDefault(); //---------------------------------------------------------------------------------------------------------- // Again verify that we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // now delete the entity client.Delete( departmentDev, dataWritten.EmployeeId); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.Department == dataWritten.Department && imp.EmployeeId == dataWritten.EmployeeId select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
Tutorial_02_Hybrid_TempHire() { //---------------------------------------------------------------------------------------------------------- // Create the Stash Client. StashClient <TempHire> client = StashConfiguration.GetClient <TempHire>(); //---------------------------------------------------------------------------------------------------------- // Create a table with the class name ('TempEmployee') or confirm that it exists client.CreateTableIfNotExist(); //---------------------------------------------------------------------------------------------------------- // Create an instance of the class we what to Stash TempHire dataWritten = new TempHire { PartitionKey = "B", RowKey = Guid.NewGuid().ToString(), Name = "Jill Doe", Skill_Level = 5, DateOfBirth = new DateTime(1990, 1, 1) }; // update the private field dataWritten.SetHourlyPay(); //---------------------------------------------------------------------------------------------------------- // Stash it client.Insert(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data TempHire dataRead = client.Get(dataWritten.PartitionKey, dataWritten.RowKey); //---------------------------------------------------------------------------------------------------------- // Verify we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // Lets change the Skill level and update the Stash dataWritten.Skill_Level += 1; dataWritten.SetHourlyPay(); client.Update(dataWritten); //---------------------------------------------------------------------------------------------------------- // Read back the data but this time lets use LINQ dataRead = client.CreateQuery() .Where(imp => imp.PartitionKey == dataWritten.PartitionKey && imp.RowKey == dataWritten.RowKey) .FirstOrDefault(); //---------------------------------------------------------------------------------------------------------- // Again verify that we got back what we put in Assert.IsTrue(dataWritten.Equals(dataRead)); //---------------------------------------------------------------------------------------------------------- // now delete the entity client.Delete( dataWritten.PartitionKey, dataWritten.RowKey); //---------------------------------------------------------------------------------------------------------- // And verify that it was actually deleted // by attempting to read back the data var queryable = from imp in client.CreateQuery() where imp.PartitionKey == dataWritten.PartitionKey && imp.RowKey == dataWritten.RowKey select imp; Assert.IsTrue(queryable.ToList().Count == 0); //---------------------------------------------------------------------------------------------------------- // So far so good. This concludes this part of the tutorial. Go Stash! }
void AllDataImplicitQueryOnEachDatatype() { // setup AllDataImplicit item = TypeFactory <AllDataImplicit> .CreateRandomSmall(); StashClient <AllDataImplicit> client = StashConfiguration.GetClient <AllDataImplicit>(); client.Insert(item); IQueryable <AllDataImplicit> query = client.CreateQuery(); // queries bool bool boolProperty = item.BoolProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolProperty == boolProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolProperty == item.BoolProperty), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolPropertyNull == boolProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolPropertyNull == item.BoolProperty), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolPropertyNullNot == item.BoolPropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolPropertyNullNot == true), item.BoolPropertyNullNot == true ? 1 : 0); // queries int int intProperty = item.IntProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntProperty == intProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntProperty == item.IntProperty), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntPropertyNull == intProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntPropertyNull == item.IntProperty), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntPropertyNullNot == item.IntPropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntPropertyNullNot == 420), item.IntPropertyNullNot == 420 ? 1 : 0); // queries int64 Int64 int64Property = item.Int64Property; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64Property == int64Property), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64Property == item.Int64Property), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64PropertyNull == int64Property), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64PropertyNull == item.Int64Property), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64PropertyNullNot == item.Int64PropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64PropertyNullNot == 420), item.Int64PropertyNullNot == 420 ? 1 : 0); // queries double double doubleProperty = item.DoubleProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleProperty == doubleProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleProperty == item.DoubleProperty), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoublePropertyNull == doubleProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoublePropertyNull == item.DoubleProperty), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoublePropertyNullNot == item.DoublePropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoublePropertyNullNot == 420), item.DoublePropertyNullNot == 420 ? 1 : 0); // queries DateTime DateTime dateTimeProperty = item.DateTimeProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeProperty == dateTimeProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeProperty == item.DateTimeProperty), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimePropertyNull == dateTimeProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimePropertyNull == item.DateTimeProperty), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimePropertyNullNot == item.DateTimePropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimePropertyNullNot == new DateTime(2000, 1, 1)), item.DateTimePropertyNullNot == new DateTime(2000, 1, 1) ? 1 : 0); // queries Guid Guid guidProperty = item.GuidProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidProperty == guidProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidProperty == item.GuidProperty), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidPropertyNull == guidProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidPropertyNull == item.GuidProperty), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidPropertyNullNot == item.GuidPropertyNullNot), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidPropertyNullNot == Guid.NewGuid()), 0); // should never match // queries string string stringProperty = item.StringProperty; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringProperty == stringProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringProperty == item.StringProperty), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringProperty == "ABC"), item.StringProperty == "ABC" ? 1 : 0); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringPropertyNull == stringProperty), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringPropertyNull == item.StringProperty), 0); } // cleanup client.Delete(item); }
void AllDataExplicitQueryOnEachDatatype() { // setup AllDataExplicit item = TypeFactory <AllDataExplicit> .CreateRandomSmall(); StashClient <AllDataExplicit> client = StashConfiguration.GetClient <AllDataExplicit>(); client.Insert(item); IQueryable <AllDataExplicit> query = client.CreateQuery(); // queries bool bool boolField = item.BoolField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolField == boolField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolField == item.BoolField), 1); // queries bool null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolFieldNull == boolField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolFieldNull == item.BoolField), 0); } // queries bool null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.BoolFieldNullNot == item.BoolFieldNullNot), 1); // queries int int intField = item.IntField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntField == intField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntField == item.IntField), 1); // queries int null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntFieldNull == intField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntFieldNull == item.IntField), 0); } // queries int null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.IntFieldNullNot == item.IntFieldNullNot), 1); // queries int64 Int64 int64Field = item.Int64Field; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64Field == int64Field), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64Field == item.Int64Field), 1); // queries int64 null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64FieldNull == int64Field), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64FieldNull == item.Int64Field), 0); } // queries int64 null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64FieldNullNot == item.Int64FieldNullNot), 1); // queries double double doubleField = item.DoubleField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleField == doubleField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleField == item.DoubleField), 1); // queries double null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleFieldNull == doubleField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleFieldNull == item.DoubleField), 0); } // queries double null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DoubleFieldNullNot == item.DoubleFieldNullNot), 1); // queries DateTime DateTime dateTimeField = item.DateTimeField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeField == dateTimeField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeField == item.DateTimeField), 1); // queries DateTime null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeField == dateTimeField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeField == item.DateTimeField), 1); } // queries DateTime null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.DateTimeFieldNullNot == item.DateTimeFieldNullNot), 1); // queries Guid Guid guidField = item.GuidField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidField == guidField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidField == item.GuidField), 1); // queries Guid null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidFieldNull == guidField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidFieldNull == item.GuidField), 0); } // queries Guid null not QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.GuidFieldNullNot == item.GuidFieldNullNot), 1); // queries string string stringField = item.StringField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringField == stringField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringField == item.StringField), 1); // queries string null // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringFieldNull == stringField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.StringFieldNull == item.StringField), 0); } // --------------------------------------------------------------------------------------------------------- // Implicit Morph // byte byte byteFieldMin = item.ByteFieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldMin == byteFieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldMin == item.ByteFieldMin), 1); byte byteFieldMax = item.ByteFieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldMax == byteFieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldMax == item.ByteFieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldNull == item.ByteFieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteFieldNullNot == item.ByteFieldNullNot), 1); // sbyte sbyte sbyteFieldMin = item.SByteFieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldMin == sbyteFieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldMin == item.SByteFieldMin), 1); sbyte sbyteFieldMax = item.SByteFieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldMax == sbyteFieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldMax == item.SByteFieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldNull == item.ByteFieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteFieldNullNot == item.SByteFieldNullNot), 1); // int16 Int16 int16FieldMin = item.Int16FieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldMin == int16FieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldMin == item.Int16FieldMin), 1); Int16 int16FieldMax = item.Int16FieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldMax == int16FieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldMax == item.Int16FieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldNull == item.Int16FieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16FieldNullNot == item.Int16FieldNullNot), 1); // uint16 UInt16 uint16FieldMin = item.UInt16FieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldMin == uint16FieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldMin == item.UInt16FieldMin), 1); UInt16 uint16FieldMax = item.UInt16FieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldMax == uint16FieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldMax == item.UInt16FieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldNull == item.UInt16FieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16FieldNullNot == item.UInt16FieldNullNot), 1); // uint32 UInt32 uint32FieldMin = item.UInt32FieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldMin == uint32FieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldMin == item.UInt32FieldMin), 1); UInt32 uint32FieldMax = item.UInt32FieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldMax == uint32FieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldMax == item.UInt32FieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldNull == item.UInt32FieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32FieldNullNot == item.UInt32FieldNullNot), 1); // uint64 UInt64 uint64FieldMin = item.UInt64FieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldMin == uint64FieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldMin == item.UInt64FieldMin), 1); UInt64 uint64FieldMax = item.UInt64FieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldMax == uint64FieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldMax == item.UInt64FieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldNull == item.UInt64FieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64FieldNullNot == item.UInt64FieldNullNot), 1); // char char charFieldMin = item.CharFieldMin; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldMin == charFieldMin), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldMin == item.CharFieldMin), 1); char charFieldMax = item.CharFieldMax; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldMax == charFieldMax), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldMax == item.CharFieldMax), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldNull == item.CharFieldMax), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.CharFieldNullNot == item.CharFieldNullNot), 1); // Enum byte ByteEnum byteEnumField = item.ByteEnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteEnumField == byteEnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteEnumField == item.ByteEnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteEnumFieldNull == byteEnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteEnumFieldNull == item.ByteEnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.ByteEnumFieldNullNot == item.ByteEnumFieldNullNot), 1); // Enum SByte SByteEnum sbyteEnumField = item.SByteEnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteEnumField == sbyteEnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteEnumField == item.SByteEnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteEnumFieldNull == sbyteEnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteEnumFieldNull == item.SByteEnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.SByteEnumFieldNullNot == item.SByteEnumFieldNullNot), 1); // Enum Int16 Int16Enum int16EnumField = item.Int16EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16EnumField == int16EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16EnumField == item.Int16EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16EnumFieldNull == int16EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16EnumFieldNull == item.Int16EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int16EnumFieldNullNot == item.Int16EnumFieldNullNot), 1); // Enum UInt16 UInt16Enum uint16EnumField = item.UInt16EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16EnumField == uint16EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16EnumField == item.UInt16EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16EnumFieldNull == uint16EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16EnumFieldNull == item.UInt16EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt16EnumFieldNullNot == item.UInt16EnumFieldNullNot), 1); // Enum Int32 Int32Enum int32EnumField = item.Int32EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int32EnumField == int32EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int32EnumField == item.Int32EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int32EnumFieldNull == int32EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int32EnumFieldNull == item.Int32EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int32EnumFieldNullNot == item.Int32EnumFieldNullNot), 1); // Enum UInt32 UInt32Enum uint32EnumField = item.UInt32EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32EnumField == uint32EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32EnumField == item.UInt32EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32EnumFieldNull == uint32EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32EnumFieldNull == item.UInt32EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt32EnumFieldNullNot == item.UInt32EnumFieldNullNot), 1); // Enum Int64 Int64Enum int64EnumField = item.Int64EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64EnumField == int64EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64EnumField == item.Int64EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64EnumFieldNull == int64EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64EnumFieldNull == item.Int64EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.Int64EnumFieldNullNot == item.Int64EnumFieldNullNot), 1); // Enum UInt64 UInt64Enum uint64EnumField = item.UInt64EnumField; QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64EnumField == uint64EnumField), 1); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64EnumField == item.UInt64EnumField), 1); // Query against a property not in the row not supported by development storage so will fail // http://msdn.microsoft.com/en-us/library/windowsazure/gg433135.aspx if (StashConfiguration.IsConfigurationCloud) { QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64EnumFieldNull == uint64EnumField), 0); QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64EnumFieldNull == item.UInt64EnumField), 0); } QueryOnEachDatatype( query.Where(t => t.RowKey == item.RowKey && t.UInt64EnumFieldNullNot == item.UInt64EnumFieldNullNot), 1); // cleanup client.Delete(item); }