Example #1
0
        public static IEnumerator <T> GetProjectedWrapperTypedEnumerator <T>(IEnumerator <TableRow> enumerator, int propertyCount, string propertyListName, string resourceTypeName, string[] projectedProperties)
            where T : ProjectedWrapper
        {
            List <T> ts = new List <T>();

            while (enumerator.MoveNext())
            {
                TableRow current = enumerator.Current;
                Dictionary <string, object> strs = new Dictionary <string, object>();
                strs["PartitionKey"] = DevelopmentStorageDbDataContext.DecodeKeyString(current.PartitionKey);
                strs["RowKey"]       = DevelopmentStorageDbDataContext.DecodeKeyString(current.RowKey);
                strs["Timestamp"]    = current.Timestamp;
                XmlUtility.AddObjectsToDictionaryFromXml(current.Data, strs, true);
                object[] objArray = new object[propertyCount];
                for (int i = 0; i < propertyCount; i++)
                {
                    if (!strs.TryGetValue(projectedProperties[i], out objArray[i]))
                    {
                        objArray[i] = null;
                    }
                }
                ProjectedWrapperCreator projectedWrapperCreator = ProjectedWrapperCreator.GetProjectedWrapperCreator(propertyCount);
                ts.Add((T)projectedWrapperCreator.CreateProjectedWrapper(objArray, propertyListName, resourceTypeName));
            }
            return(ts.GetEnumerator());
        }
Example #2
0
        internal static XElement MergeXmlProperties(UtilityRow deltaRow, XElement existingRowXml)
        {
            UtilityRow value      = deltaRow.Clone();
            UtilityRow utilityRow = new UtilityRow();

            XmlUtility.AddObjectsToDictionaryFromXml(existingRowXml, utilityRow, true);
            foreach (KeyValuePair <string, object> columnValue in utilityRow.ColumnValues)
            {
                if (value.ColumnValues.ContainsKey(columnValue.Key) && value[columnValue.Key] != null)
                {
                    continue;
                }
                value[columnValue.Key] = columnValue.Value;
            }
            return(XmlUtility.GetXmlFromUtilityRow(value));
        }
Example #3
0
        public static object GetUtilityRowEnumerator(IEnumerator <TableRow> enumerator)
        {
            List <UtilityRow> utilityRows = new List <UtilityRow>();

            while (enumerator.MoveNext())
            {
                TableRow   current    = enumerator.Current;
                UtilityRow utilityRow = new UtilityRow()
                {
                    PartitionKey = DevelopmentStorageDbDataContext.DecodeKeyString(current.PartitionKey),
                    RowKey       = DevelopmentStorageDbDataContext.DecodeKeyString(current.RowKey),
                    Timestamp    = current.Timestamp
                };
                XmlUtility.AddObjectsToDictionaryFromXml(current.Data, utilityRow, false);
                utilityRows.Add(utilityRow);
            }
            return(utilityRows.GetEnumerator());
        }
Example #4
0
        internal static void AddObjectsToDictionaryFromXml(XElement xmlRoot, UtilityRow entity, bool shouldIncludeNull)
        {
            Dictionary <string, object> strs = new Dictionary <string, object>();

            XmlUtility.AddObjectsToDictionaryFromXml(xmlRoot, entity.ColumnValues, shouldIncludeNull);
        }