/// <inheritdoc />
        public void Resolve()
        {
            if (EntityFrameworkCoreIsEnabled())
            {
                DbContext context = _resolver.GetContext();

                foreach (ResourceContext ce in _provider.GetResourceContexts())
                {
                    IEntityType meta = context.Model.FindEntityType(ce.ResourceType);
                    if (meta == null)
                    {
                        continue;
                    }
                    foreach (var attr in ce.Relationships)
                    {
                        if (attr is HasManyThroughAttribute)
                        {
                            continue;
                        }
                        INavigation inverseNavigation = meta.FindNavigation(attr.PropertyInfo.Name)?.FindInverse();
                        attr.InverseNavigation = inverseNavigation?.Name;
                    }
                }
            }
        }
 private void Resolve(DbContext dbContext)
 {
     foreach (ResourceContext resourceContext in _resourceContextProvider.GetResourceContexts())
     {
         IEntityType entityType = dbContext.Model.FindEntityType(resourceContext.ResourceType);
         if (entityType != null)
         {
             ResolveRelationships(resourceContext.Relationships, entityType);
         }
     }
 }
 private void Resolve(DbContext dbContext)
 {
     foreach (ResourceContext resourceContext in _resourceContextProvider.GetResourceContexts())
     {
         IEntityType entityType = dbContext.Model.FindEntityType(resourceContext.ResourceType);
         if (entityType != null)
         {
             foreach (var relationship in resourceContext.Relationships)
             {
                 if (!(relationship is HasManyThroughAttribute))
                 {
                     INavigation inverseNavigation = entityType.FindNavigation(relationship.Property.Name)?.FindInverse();
                     relationship.InverseNavigationProperty = inverseNavigation?.PropertyInfo;
                 }
             }
         }
     }
 }
예제 #4
0
        public IEnumerable <IEntityType> GetEntityTypes()
        {
            var resourceContexts = _resourceContextProvider.GetResourceContexts();

            return(resourceContexts.Select(resourceContext => new MongoEntityType(resourceContext, this)));
        }