示例#1
0
        public void Update( string partitionKey, string rowKey, Guid callerInstanceId, GenericEntity entity )
        {
            bool entityExists = HasEntity( partitionKey, rowKey );
             if ( !entityExists )
             {
            throw new EntityDoesNotExistException();
             }

             var actualEntity = TableEntries.Single( e => EntryKeysMatch( partitionKey, rowKey, e ) );

             Dictionary<string, object> serializedData = entity.GetProperties().ToDictionary( kp => kp.Key, kp => kp.Value.Value );
             actualEntity.Value.Modify( callerInstanceId, serializedData );
        }
示例#2
0
        public void Add( string partitionKey, string rowKey, Guid callerInstanceId, GenericEntity entity )
        {
            Dictionary<string, object> properties = entity.GetProperties().ToDictionary( kp => kp.Key, kp => kp.Value.Value );

             var tableServiceEntity = new TableServiceEntity( partitionKey, rowKey );

             var entry = new MemoryTableEntry( properties, callerInstanceId );

             if ( HasEntity( partitionKey, rowKey ) )
             {
            throw new EntityAlreadyExistsException();
             }
             _tableEntries[tableServiceEntity] = entry;
        }