public override MetaType GetMetaType(Type type) { if (type == null) { throw Error.ArgumentNull("type"); } MetaType mtype = null; @lock.AcquireReaderLock(Timeout.Infinite); try { if (this.metaTypes.TryGetValue(type, out mtype)) { return(mtype); } } finally { @lock.ReleaseReaderLock(); } @lock.AcquireWriterLock(Timeout.Infinite); try { if (!this.metaTypes.TryGetValue(type, out mtype)) { // not known, so must be unmapped type mtype = new UnmappedType(this, type); this.metaTypes.Add(type, mtype); } } finally { @lock.ReleaseWriterLock(); } return(mtype); }
public override MetaType GetMetaType(Type type) { if (type == null) { throw Error.ArgumentNull("type"); } var nonProxyType = UnproxyType(type); MetaType mtype; metaModelLock.AcquireReaderLock(Timeout.Infinite); try { if (metaTypes.TryGetValue(nonProxyType, out mtype)) { return(mtype); } } finally { metaModelLock.ReleaseReaderLock(); } // Attributed meta model allows us to learn about tables we did not // statically know about var tab = GetTable(nonProxyType); if (tab != null) { return(tab.RowType.GetInheritanceType(nonProxyType)); } InitFunctions(); metaModelLock.AcquireWriterLock(Timeout.Infinite); try { if (!metaTypes.TryGetValue(nonProxyType, out mtype)) { mtype = new UnmappedType(this, nonProxyType); metaTypes.Add(nonProxyType, mtype); } } finally { metaModelLock.ReleaseWriterLock(); } return(mtype); }
public override MetaType GetMetaType(Type type) { if (type == (Type)null) { throw System.Data.Linq.Mapping.Error.ArgumentNull("type"); } MetaType value = null; @lock.AcquireReaderLock(-1); try { if (metaTypes.TryGetValue(type, out value)) { return(value); } } finally { @lock.ReleaseReaderLock(); } MetaTable table = GetTable(type); if (table == null) { InitFunctions(); @lock.AcquireWriterLock(-1); try { if (metaTypes.TryGetValue(type, out value)) { return(value); } value = new UnmappedType(this, type); metaTypes.Add(type, value); return(value); } finally { @lock.ReleaseWriterLock(); } } return(table.RowType.GetInheritanceType(type)); }
public override MetaType GetMetaType(Type type) { if (type == null) { throw Error.ArgumentNull("type"); } MetaType mtype = null; @lock.AcquireReaderLock(Timeout.Infinite); try { if (this.metaTypes.TryGetValue(type, out mtype)) { return mtype; } } finally { @lock.ReleaseReaderLock(); } // Attributed meta model allows us to learn about tables we did not // statically know about MetaTable tab = this.GetTable(type); if (tab != null) { return tab.RowType.GetInheritanceType(type); } this.InitFunctions(); @lock.AcquireWriterLock(Timeout.Infinite); try { if (!this.metaTypes.TryGetValue(type, out mtype)) { mtype = new UnmappedType(this, type); this.metaTypes.Add(type, mtype); } } finally { @lock.ReleaseWriterLock(); } return mtype; }
public override MetaType GetMetaType(Type type) { if (type == null) { throw Error.ArgumentNull("type"); } MetaType mtype = null; @lock.AcquireReaderLock(Timeout.Infinite); try { if (this.metaTypes.TryGetValue(type, out mtype)) { return mtype; } } finally { @lock.ReleaseReaderLock(); } @lock.AcquireWriterLock(Timeout.Infinite); try { if (!this.metaTypes.TryGetValue(type, out mtype)) { // not known, so must be unmapped type mtype = new UnmappedType(this, type); this.metaTypes.Add(type, mtype); } } finally { @lock.ReleaseWriterLock(); } return mtype; }