/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual IReadOnlyList <FileContextTableSnapshot> GetTables(IEntityType entityType) { List <FileContextTableSnapshot> data = new List <FileContextTableSnapshot>(); lock (_lock) { foreach (IEntityType et in entityType.GetConcreteTypesInHierarchy()) { if (!_tables.Value.TryGetValue(et, out IFileContextTable table)) { _tables.Value.Add(entityType, table = _tableFactory.Create(entityType)); } data.Add(new FileContextTableSnapshot(et, table.SnapshotRows())); } } return(data); }
// Must be called from inside the lock private IFileContextTable EnsureTable(object key, IEntityType entityType) { if (_tables == null) { _tables = CreateTables(); } if (!_tables.TryGetValue(key, out var table)) { _tables.Add(key, table = _tableFactory.Create(entityType)); } return(table); }