Пример #1
0
 /// <inheritdoc />
 public override void ProcessModelFinalizing(
     IConventionModelBuilder modelBuilder,
     IConventionContext <IConventionModelBuilder> context)
 {
     foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
     {
         var definingQuery = entityType.GetInMemoryQuery();
         if (definingQuery != null)
         {
             entityType.SetInMemoryQuery((LambdaExpression)DbSetAccessRewriter.Rewrite(modelBuilder.Metadata, definingQuery));
         }
     }
 }
Пример #2
0
        /// <inheritdoc />
        public override void ProcessModelFinalizing(
            IConventionModelBuilder modelBuilder,
            IConventionContext <IConventionModelBuilder> context)
        {
            foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
            {
                var queryFilter = entityType.GetQueryFilter();
                if (queryFilter != null)
                {
                    entityType.SetQueryFilter((LambdaExpression)DbSetAccessRewriter.Rewrite(modelBuilder.Metadata, queryFilter));
                }

#pragma warning disable CS0618 // Type or member is obsolete
                var definingQuery = ((IEntityType)entityType).GetDefiningQuery();
                if (definingQuery != null)
                {
                    entityType.SetDefiningQuery((LambdaExpression)DbSetAccessRewriter.Rewrite(modelBuilder.Metadata, definingQuery));
                }
#pragma warning restore CS0618 // Type or member is obsolete
            }
        }