Example #1
0
        protected override void ProcessModelAnnotations(
            Dictionary <string, object?> annotations, IModel model, RuntimeModel runtimeModel, bool runtime)
        {
            base.ProcessModelAnnotations(annotations, model, runtimeModel, runtime);

            if (runtime)
            {
                annotations[RelationalAnnotationNames.RelationalModel] =
                    RelationalModel.Create(runtimeModel, RelationalDependencies.RelationalAnnotationProvider, designTime: false);
            }
            else
            {
                annotations.Remove(RelationalAnnotationNames.Collation);

                if (annotations.TryGetValue(RelationalAnnotationNames.DbFunctions, out var functions))
                {
                    var runtimeFunctions = new SortedDictionary <string, IDbFunction>(StringComparer.Ordinal);
                    foreach (var functionPair in (SortedDictionary <string, IDbFunction>)functions !)
                    {
                        var runtimeFunction = Create(functionPair.Value, runtimeModel);
                        runtimeFunctions[functionPair.Key] = runtimeFunction;

                        foreach (var parameter in functionPair.Value.Parameters)
                        {
                            var runtimeParameter = Create(parameter, runtimeFunction);

                            CreateAnnotations(parameter, runtimeParameter, static (convention, annotations, source, target, runtime) =>
Example #2
0
        protected override void ProcessModelAnnotations(
            Dictionary <string, object?> annotations, IModel model, SlimModel slimModel, bool runtime)
        {
            base.ProcessModelAnnotations(annotations, model, slimModel, runtime);

            if (runtime)
            {
                annotations[RelationalAnnotationNames.RelationalModel] =
                    RelationalModel.Create(slimModel, RelationalDependencies.RelationalAnnotationProvider);
            }
            else
            {
                if (annotations.TryGetValue(RelationalAnnotationNames.DbFunctions, out var functions))
                {
                    var slimFunctions = new SortedDictionary <string, IDbFunction>();
                    foreach (var functionPair in (SortedDictionary <string, IDbFunction>)functions !)
                    {
                        var slimFunction = Create(functionPair.Value, slimModel);
                        slimFunctions[functionPair.Key] = slimFunction;

                        foreach (var parameter in functionPair.Value.Parameters)
                        {
                            var slimParameter = Create(parameter, slimFunction);

                            CreateAnnotations(parameter, slimParameter, static (convention, annotations, source, target, runtime) =>