예제 #1
0
 static void Read(ref RepositoryRow row, BinaryReader reader)
 {
     row.Id             = reader.ReadUInt32();
     row.ModuleId       = reader.ReadUInt32();
     row.ParentModuleId = reader.ReadUInt32();
     row.Name           = reader.ReadString();
     row.OwnerId        = reader.ReadUInt32();
     row.GuidHigh       = reader.ReadInt64();
     row.GuidLow        = reader.ReadInt64();
 }
예제 #2
0
        internal static RepositoryRow ReadFirst(
            IReadCondition <RepositoryRow> condition, string path)
        {
            RepositoryRow row = new RepositoryRow();

            using (BinaryReader reader = IOBuilder.CreateBinaryReader(path))
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    Read(ref row, reader);
                    if (condition == null || condition.Matches(ref row))
                    {
                        return(row);
                    }
                }

            return(RepositoryRow.Empty);
        }
예제 #3
0
        internal static List <RepositoryRow> Read(
            IReadCondition <RepositoryRow> condition, string path)
        {
            List <RepositoryRow> result = new List <RepositoryRow>();
            RepositoryRow        row    = new RepositoryRow();

            using (BinaryReader reader = IOBuilder.CreateBinaryReader(path))
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    Read(ref row, reader);
                    if (condition == null || condition.Matches(ref row))
                    {
                        result.Add(row);
                    }
                }
            return(result);
        }
        private void RowRemoved(RepositoryRow row)
        {
            lock (_items)
            {
                T item;
                if (_itemsLookup.TryGetValue(row.RowId, out item))
                {
                    var index = _items.IndexOf(item);
                    _items.RemoveAt(index);

                    AddCollectionChange(
                        new NotifyCollectionChangedEventArgs(
                            NotifyCollectionChangedAction.Remove,
                            item, index));

                    ProcessCollectionChanged();
                }
            }
        }
        private void RowAdded(RepositoryRow row)
        {
            lock (_items)
            {
                var item = new T();
                item.SetRow(row);
                item.SetRepository(_repository);

                _items.Add(item);
                _itemsLookup[row.RowId] = item;

                AddCollectionChange(
                    new NotifyCollectionChangedEventArgs(
                        NotifyCollectionChangedAction.Add,
                        item));

                ProcessCollectionChanged();
            }
        }
예제 #6
0
 internal void SetRow(RepositoryRow row)
 {
     _row = row;
 }
예제 #7
0
 public HousingRow(string postCode, RepositoryRow row, HousingRepository repository)
 {
     _row        = row;
     _repository = repository;
     PostCode    = postCode;
 }