Пример #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 virtual IModel?Process(IReadOnlyModel?model)
        {
            if (model == null)
            {
                return(null);
            }

            var version = model.GetProductVersion();

            if (version != null)
            {
                ProcessElement(model, version);
                UpdateSequences(model, version);

                foreach (var entityType in model.GetEntityTypes())
                {
                    ProcessElement(entityType, version);
                    ProcessCollection(entityType.GetProperties(), version);
                    ProcessCollection(entityType.GetKeys(), version);
                    ProcessCollection(entityType.GetIndexes(), version);

                    foreach (var element in entityType.GetForeignKeys())
                    {
                        ProcessElement(element, version);
                        ProcessElement(element.DependentToPrincipal, version);
                        ProcessElement(element.PrincipalToDependent, version);
                    }
                }
            }

            return(_modelRuntimeInitializer.Initialize((IModel)model, designTime: true, validationLogger: null));
        }
Пример #2
0
        private IModel FinalizeModel(IModel model)
        {
            if (model is IMutableModel mutableModel)
            {
                model = mutableModel.FinalizeModel();
            }

            return(_modelRuntimeInitializer.Initialize(model, designTime: true, validationLogger: null));
        }
Пример #3
0
 public IModel FinalizeModel(bool designTime = false, bool skipValidation = false)
 => _modelRuntimeInitializer.Initialize((IModel)Model, designTime, skipValidation ? null : _validationLogger);
Пример #4
0
 private IModel FinalizeModel(IModel model)
 => _modelRuntimeInitializer.Initialize(model, designTime: true, validationLogger: null);