-
-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathAssociationTypeContainer.cs
More file actions
23 lines (20 loc) · 994 Bytes
/
Copy pathAssociationTypeContainer.cs
File metadata and controls
23 lines (20 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System.Collections.Generic;
using System.Data.Entity.Core.Metadata.Edm;
using System.Linq;
namespace SQLite.CodeFirst.Utility
{
internal class AssociationTypeContainer
{
private readonly IEnumerable<SqliteAssociationType> sqliteAssociationTypes;
public AssociationTypeContainer(IEnumerable<AssociationType> associationTypes, EntityContainer container)
{
// Materialize once. GetAssociationTypes is called per entity set, so a deferred query
// would rebuild every SqliteAssociationType (and its entity-set lookups) on each call.
sqliteAssociationTypes = associationTypes.Select(associationType => new SqliteAssociationType(associationType, container)).ToList();
}
public IEnumerable<SqliteAssociationType> GetAssociationTypes(string entitySetName)
{
return sqliteAssociationTypes.Where(associationType => associationType.ToRoleEntitySetName == entitySetName);
}
}
}