Exemplo n.º 1
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public RelationshipSnapshot(
     [NotNull] InternalRelationshipBuilder relationship,
     [CanBeNull] EntityType.Snapshot definedEntityTypeSnapshot)
 {
     Relationship = relationship;
     DefinedEntityTypeSnapshot = definedEntityTypeSnapshot;
 }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public RelationshipSnapshot(
     [NotNull] InternalRelationshipBuilder relationship,
     [CanBeNull] EntityType.Snapshot weakEntityTypeSnapshot)
 {
     Relationship           = relationship;
     WeakEntityTypeSnapshot = weakEntityTypeSnapshot;
 }
Exemplo n.º 3
0
        private InternalEntityTypeBuilder Entity(
            TypeIdentity type,
            string definingNavigationName,
            EntityType definingEntityType,
            ConfigurationSource configurationSource)
        {
            if (IsIgnored(type, configurationSource))
            {
                return(null);
            }

            var clrType        = type.Type;
            var weakEntityType = clrType == null
                ? Metadata.FindEntityType(type.Name, definingNavigationName, definingEntityType)
                : Metadata.FindEntityType(clrType, definingNavigationName, definingEntityType);

            if (weakEntityType == null)
            {
                var entityType = clrType == null
                    ? Metadata.FindEntityType(type.Name)
                    : Metadata.FindEntityType(clrType);

                IConventionBatch    batch = null;
                EntityType.Snapshot entityTypeSnapshot = null;
                if (entityType != null)
                {
                    if (!configurationSource.Overrides(entityType.GetConfigurationSource()))
                    {
                        return(null);
                    }

                    batch = ModelBuilder.Metadata.ConventionDispatcher.StartBatch();
                    entityTypeSnapshot = InternalEntityTypeBuilder.DetachAllMembers(entityType);

                    Ignore(entityType, configurationSource);
                }

                if (clrType == null)
                {
                    Metadata.Unignore(type.Name);

                    weakEntityType = Metadata.AddEntityType(type.Name, definingNavigationName, definingEntityType, configurationSource);
                }
                else
                {
                    Metadata.Unignore(clrType);

                    weakEntityType = Metadata.AddEntityType(clrType, definingNavigationName, definingEntityType, configurationSource);
                }

                if (batch != null)
                {
                    entityTypeSnapshot.Attach(weakEntityType.Builder);
                    batch.Dispose();
                }
            }
            else
            {
                weakEntityType.UpdateConfigurationSource(configurationSource);
            }

            return(weakEntityType?.Builder);
        }
Exemplo n.º 4
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public RelationshipSnapshot(
     [NotNull] InternalRelationshipBuilder relationship,
     [CanBeNull] EntityType.Snapshot definedEntityTypeSnapshot,
     [CanBeNull] List <(SkipNavigation, ConfigurationSource)> referencingSkipNavigations)