コード例 #1
0
ファイル: InMemoryMetaStore.cs プロジェクト: rho24/PocoDb
        public IPocoMeta Get(IPocoId id) {
            if (!_lock.TryEnterReadLock(TimeSpan.FromMilliseconds(100)))
                throw new ApplicationException("Could not enter read lock");

            try {
                return Metas.ContainsKey(id) ? Metas[id] : null;
            }
            finally {
                _lock.ExitReadLock();
            }
        }
コード例 #2
0
ファイル: ServerPocoGetter.cs プロジェクト: rho24/PocoDb
        public object GetPoco(IPocoId id) {
            var meta = Server.MetaStore.Get(id);

            if (meta == null)
                throw new ArgumentException("id is not recognised");

            var pocoProxyBuilder = new ReadOnlyPocoProxyBuilder();
            var collectionProxyBuilder = new ReadOnlyCollectionProxyBuilder();
            pocoProxyBuilder.Initialise(this);
            collectionProxyBuilder.Initialise(this);
            var pocoFactory = new PocoFactory(pocoProxyBuilder, collectionProxyBuilder);

            return pocoFactory.Build(meta, IdsMetasAndProxies);
        }
コード例 #3
0
ファイル: PocoDbServer.cs プロジェクト: rho24/PocoDb
 public IPocoMeta GetMeta(IPocoId id) {
     return MetaStore.Get(id);
 }
コード例 #4
0
ファイル: CollectionRemoval.cs プロジェクト: rho24/PocoDb
 public CollectionRemoval(IPocoId collectionId, object value) {
     CollectionId = collectionId;
     Value = value;
 }
コード例 #5
0
ファイル: CollectionAddition.cs プロジェクト: rho24/PocoDb
 public CollectionAddition(IPocoId collectionId, object value) {
     CollectionId = collectionId;
     Value = value;
 }
コード例 #6
0
ファイル: InMemoryMetaStore.cs プロジェクト: rho24/PocoDb
 public IPocoMeta GetWritable(IPocoId id) {
     return Get(id);
 }
コード例 #7
0
ファイル: PocoMeta.cs プロジェクト: rho24/PocoDb
 public PocoMeta(IPocoId id, Type type) {
     Id = id;
     Type = type;
     Properties = new Dictionary<IProperty, object>();
     Collection = new List<object>();
 }