diff --git a/src/EFCore.Design/Design/Internal/CSharpHelper.cs b/src/EFCore.Design/Design/Internal/CSharpHelper.cs index 219324d0882..425a490e0dc 100644 --- a/src/EFCore.Design/Design/Internal/CSharpHelper.cs +++ b/src/EFCore.Design/Design/Internal/CSharpHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections; using System.Globalization; using System.Numerics; @@ -9,6 +8,8 @@ using System.Security; using System.Text; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Simplification; using Microsoft.CodeAnalysis.Text; @@ -27,7 +28,7 @@ public class CSharpHelper : ICSharpHelper { private readonly ITypeMappingSource _typeMappingSource; private readonly Project _project; - private readonly LinqToCSharpSyntaxTranslator _translator; + private readonly RuntimeModelLinqToCSharpSyntaxTranslator _translator; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -45,11 +46,11 @@ public CSharpHelper(ITypeMappingSource typeMappingSource) var projectInfo = ProjectInfo.Create(projectId, versionStamp, "Proj", "Proj", LanguageNames.CSharp); _project = workspace.AddProject(projectInfo); var syntaxGenerator = SyntaxGenerator.GetGenerator(workspace, LanguageNames.CSharp); - _translator = new LinqToCSharpSyntaxTranslator(syntaxGenerator); + _translator = new RuntimeModelLinqToCSharpSyntaxTranslator(syntaxGenerator); } - private static readonly IReadOnlyCollection Keywords = new[] - { + private static readonly IReadOnlyCollection Keywords = + [ "__arglist", "__makeref", "__reftype", @@ -131,7 +132,7 @@ public CSharpHelper(ITypeMappingSource typeMappingSource) "void", "volatile", "while" - }; + ]; private static readonly IReadOnlyDictionary> LiteralFuncs = new Dictionary> @@ -1435,13 +1436,13 @@ public virtual string Fragment(AttributeCodeFragment fragment) } builder - .Append("[") + .Append('[') .Append(attributeName); if (fragment.Arguments.Count != 0 || fragment.NamedArguments.Count != 0) { - builder.Append("("); + builder.Append('('); var first = true; foreach (var value in fragment.Arguments) @@ -1475,10 +1476,10 @@ public virtual string Fragment(AttributeCodeFragment fragment) .Append(UnknownLiteral(item.Value)); } - builder.Append(")"); + builder.Append(')'); } - builder.Append("]"); + builder.Append(']'); return builder.ToString(); } @@ -1552,8 +1553,40 @@ private string ToSourceCode(SyntaxNode node) /// 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. /// - public virtual string Statement(Expression node, ISet collectedNamespaces) - => ToSourceCode(_translator.TranslateStatement(node, collectedNamespaces)); + public virtual string Statement( + Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces) + { + Dictionary? constantReplacementExpressions = null; + if (constantReplacements != null) + { + constantReplacementExpressions = []; + + foreach (var instancePair in constantReplacements) + { + constantReplacementExpressions[instancePair.Key] = SyntaxFactory.IdentifierName(instancePair.Value); + } + } + + Dictionary? memberAccessReplacementExpressions = null; + if (memberAccessReplacements != null) + { + memberAccessReplacementExpressions = []; + + foreach (var methodPair in memberAccessReplacements) + { + memberAccessReplacementExpressions[methodPair.Key] = SyntaxFactory.IdentifierName(methodPair.Value); + } + } + + return ToSourceCode(_translator.TranslateStatement( + node, + constantReplacementExpressions, + memberAccessReplacementExpressions, + collectedNamespaces)); + } /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -1561,8 +1594,40 @@ public virtual string Statement(Expression node, ISet collectedNamespace /// 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. /// - public virtual string Expression(Expression node, ISet collectedNamespaces) - => ToSourceCode(_translator.TranslateExpression(node, collectedNamespaces)); + public virtual string Expression( + Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces) + { + Dictionary? constantReplacementExpressions = null; + if (constantReplacements != null) + { + constantReplacementExpressions = []; + + foreach (var instancePair in constantReplacements) + { + constantReplacementExpressions[instancePair.Key] = SyntaxFactory.IdentifierName(instancePair.Value); + } + } + + Dictionary? memberAccessReplacementExpressions = null; + if (memberAccessReplacements != null) + { + memberAccessReplacementExpressions = []; + + foreach (var methodPair in memberAccessReplacements) + { + memberAccessReplacementExpressions[methodPair.Key] = SyntaxFactory.IdentifierName(methodPair.Value); + } + } + + return ToSourceCode(_translator.TranslateExpression( + node, + constantReplacementExpressions, + memberAccessReplacementExpressions, + collectedNamespaces)); + } private static bool IsIdentifierStartCharacter(char ch) { diff --git a/src/EFCore.Design/Query/Internal/ILinqToCSharpSyntaxTranslator.cs b/src/EFCore.Design/Query/Internal/ILinqToCSharpSyntaxTranslator.cs deleted file mode 100644 index 50f6a28061d..00000000000 --- a/src/EFCore.Design/Query/Internal/ILinqToCSharpSyntaxTranslator.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.CodeAnalysis; - -namespace Microsoft.EntityFrameworkCore.Query.Internal; - -/// -/// Translates a LINQ expression tree to a Roslyn syntax tree. -/// -/// -/// 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. -/// -public interface ILinqToCSharpSyntaxTranslator -{ - /// - /// Translates a node representing a statement into a Roslyn syntax tree. - /// - /// The node to be translated. - /// Any namespaces required by the translated code will be added to this set. - /// A Roslyn syntax tree representation of . - /// - /// 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. - /// - SyntaxNode TranslateStatement(Expression node, ISet collectedNamespaces); - - /// - /// Translates a node representing an expression into a Roslyn syntax tree. - /// - /// The node to be translated. - /// Any namespaces required by the translated code will be added to this set. - /// A Roslyn syntax tree representation of . - /// - /// 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. - /// - SyntaxNode TranslateExpression(Expression node, ISet collectedNamespaces); - - /// - /// Returns the captured variables detected in the last translation. - /// - /// - /// 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. - /// - IReadOnlySet CapturedVariables { get; } -} diff --git a/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs b/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs index 8cfcc69b839..b46174daa09 100644 --- a/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs +++ b/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs @@ -4,15 +4,16 @@ using System.Collections; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; -using ConditionalExpression = System.Linq.Expressions.ConditionalExpression; using E = System.Linq.Expressions.Expression; namespace Microsoft.EntityFrameworkCore.Query.Internal; @@ -23,7 +24,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal; /// 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. /// -public class LinqToCSharpSyntaxTranslator : ExpressionVisitor, ILinqToCSharpSyntaxTranslator +public class LinqToCSharpSyntaxTranslator : ExpressionVisitor { private sealed record StackFrame( Dictionary Variables, @@ -32,13 +33,7 @@ private sealed record StackFrame( HashSet UnnamedLabelNames); private readonly Stack _stack - = new( - new[] - { - new StackFrame( - new Dictionary(), [], new Dictionary(), - []) - }); + = new([new StackFrame([], [], [], [])]); private int _unnamedParameterCounter; @@ -51,14 +46,13 @@ private sealed record LiftedState( private LiftedState _liftedState = new([], new Dictionary(), [], []); private ExpressionContext _context; + private Dictionary? _constantReplacements; private bool _onLastLambdaLine; private readonly HashSet _capturedVariables = []; private ISet _collectedNamespaces = null!; private static MethodInfo? _activatorCreateInstanceMethod; - private static MethodInfo? _typeGetFieldMethod; - private static MethodInfo? _fieldGetValueMethod; private static MethodInfo? _mathPowMethod; private readonly SideEffectDetectionSyntaxWalker _sideEffectDetector = new(); @@ -82,7 +76,7 @@ public LinqToCSharpSyntaxTranslator(SyntaxGenerator syntaxGenerator) /// 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. /// - public IReadOnlySet CapturedVariables + public virtual IReadOnlySet CapturedVariables => _capturedVariables.ToHashSet(); /// @@ -99,8 +93,11 @@ public IReadOnlySet CapturedVariables /// 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. /// - public virtual SyntaxNode TranslateStatement(Expression node, ISet collectedNamespaces) - => TranslateCore(node, collectedNamespaces, statementContext: true); + public virtual SyntaxNode TranslateStatement( + Expression node, + Dictionary? constantReplacements, + ISet collectedNamespaces) + => TranslateCore(node, constantReplacements, collectedNamespaces, statementContext: true); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -108,8 +105,11 @@ public virtual SyntaxNode TranslateStatement(Expression node, ISet colle /// 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. /// - public virtual SyntaxNode TranslateExpression(Expression node, ISet collectedNamespaces) - => TranslateCore(node, collectedNamespaces, statementContext: false); + public virtual SyntaxNode TranslateExpression( + Expression node, + Dictionary? constantReplacements, + ISet collectedNamespaces) + => TranslateCore(node, constantReplacements, collectedNamespaces, statementContext: false); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -117,9 +117,14 @@ public virtual SyntaxNode TranslateExpression(Expression node, ISet coll /// 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. /// - protected virtual SyntaxNode TranslateCore(Expression node, ISet collectedNamespaces, bool statementContext = false) + protected virtual SyntaxNode TranslateCore( + Expression node, + Dictionary? constantReplacements, + ISet collectedNamespaces, + bool statementContext) { _capturedVariables.Clear(); + _constantReplacements = constantReplacements; _collectedNamespaces = collectedNamespaces; _unnamedParameterCounter = 0; _context = statementContext ? ExpressionContext.Statement : ExpressionContext.Expression; @@ -127,12 +132,10 @@ protected virtual SyntaxNode TranslateCore(Expression node, ISet collect Visit(node); - if (_liftedState.Statements.Count > 0) + if (_liftedState.Statements.Count > 0 + && _context == ExpressionContext.Expression) { - if (_context == ExpressionContext.Expression) - { - throw new NotSupportedException("Lifted expressions remaining at top-level in expression context"); - } + throw new NotSupportedException("Lifted expressions remaining at top-level in expression context"); } Check.DebugAssert(_stack.Count == 1, "_parameterStack.Count == 1"); @@ -351,77 +354,57 @@ protected override Expression VisitBinary(BinaryExpression binary) Expression VisitAssignment(BinaryExpression assignment, SyntaxKind kind) { - var translatedLeft = Translate(assignment.Left); - - ExpressionSyntax translatedRight; - - // LINQ expression trees can directly access private members, but C# code cannot. - // If a private member is being set, VisitMember generated a reflection GetValue invocation for it; detect - // that here and replace it with SetValue instead. - // TODO: Replace this with a more efficient API for .NET 8.0. - // TODO: Private property - if (translatedLeft is InvocationExpressionSyntax - { - Expression: MemberAccessExpressionSyntax - { - Name.Identifier.Text: nameof(FieldInfo.GetValue), - Expression: var fieldInfoExpression - }, - ArgumentList.Arguments: [var lValue] - }) + if (assignment.Left is MemberExpression { Member: FieldInfo { IsPublic: false } } member) { - // If we have a simple assignment, use the RHS directly (fieldInfo.SetValue(lValue, rValue)). - // For compound assignment operators, apply the appropriate operator (fieldInfo.setValue(lValue, rValue + lValue) - translatedRight = Translate(assignment.Right); - + // For compound assignment operators, apply the appropriate operator before translating if (kind != SyntaxKind.SimpleAssignmentExpression) { - var nonAssignmentOperator = kind switch + var expandedRight = kind switch { - SyntaxKind.AddAssignmentExpression => SyntaxKind.AddExpression, - SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.MultiplyExpression, - SyntaxKind.DivideAssignmentExpression => SyntaxKind.DivideExpression, - SyntaxKind.ModuloAssignmentExpression => SyntaxKind.ModuloExpression, - SyntaxKind.SubtractAssignmentExpression => SyntaxKind.SubtractExpression, - SyntaxKind.AndAssignmentExpression => SyntaxKind.BitwiseAndExpression, - SyntaxKind.OrAssignmentExpression => SyntaxKind.BitwiseOrExpression, - SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LeftShiftExpression, - SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.RightShiftExpression, - SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.ExclusiveOrExpression, + SyntaxKind.AddAssignmentExpression => E.Add(assignment.Left, assignment.Right), + SyntaxKind.MultiplyAssignmentExpression => E.Multiply(assignment.Left, assignment.Right), + SyntaxKind.DivideAssignmentExpression => E.Divide(assignment.Left, assignment.Right), + SyntaxKind.ModuloAssignmentExpression => E.Modulo(assignment.Left, assignment.Right), + SyntaxKind.SubtractAssignmentExpression => E.Subtract(assignment.Left, assignment.Right), + SyntaxKind.AndAssignmentExpression => E.And(assignment.Left, assignment.Right), + SyntaxKind.OrAssignmentExpression => E.Or(assignment.Left, assignment.Right), + SyntaxKind.ExclusiveOrAssignmentExpression => E.ExclusiveOr(assignment.Left, assignment.Right), + SyntaxKind.LeftShiftAssignmentExpression => E.LeftShift(assignment.Left, assignment.Right), + SyntaxKind.RightShiftAssignmentExpression => E.RightShift(assignment.Left, assignment.Right), _ => throw new UnreachableException() }; - translatedRight = BinaryExpression(nonAssignmentOperator, translatedLeft, translatedRight); + Result = Translate(E.Assign(assignment.Left, expandedRight)); + + return assignment; } - Result = InvocationExpression( - MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - fieldInfoExpression, - IdentifierName(nameof(FieldInfo.SetValue))), - ArgumentList( - SeparatedList(new[] { lValue, Argument(translatedRight) }))); + TranslateNonPublicFieldAssignment(member, assignment.Right); + + return assignment; + } + + // TODO: Private property + + var translatedLeft = Translate(assignment.Left); + + // Identify assignment where the RHS supports assignment lowering (switch, conditional). If the e.g. switch expression is + // lifted out (because some arm contains a block), this will lower the variable to be assigned inside the resulting switch + // statement, rather then adding another useless temporary variable. + var translatedRight = Translate( + assignment.Right, + lowerableAssignmentVariable: translatedLeft as IdentifierNameSyntax); + + // If the RHS was lifted out and the assignment lowering succeeded, Translate above returns the lowered assignment variable; + // this would mean that we return a useless identity assignment (i = i). Instead, just return it. + if (translatedRight == translatedLeft) + { + Result = translatedRight; } else { - // Identify assignment where the RHS supports assignment lowering (switch, conditional). If the e.g. switch expression is - // lifted out (because some arm contains a block), this will lower the variable to be assigned inside the resulting switch - // statement, rather then adding another useless temporary variable. - translatedRight = Translate( - assignment.Right, - lowerableAssignmentVariable: translatedLeft as IdentifierNameSyntax); - - // If the RHS was lifted out and the assignment lowering succeeded, Translate above returns the lowered assignment variable; - // this would mean that we return a useless identity assignment (i = i). Instead, just return it. - if (translatedRight == translatedLeft) - { - Result = translatedRight; - } - else - { - Result = AssignmentExpression(kind, translatedLeft, translatedRight); - } + Result = AssignmentExpression(kind, translatedLeft, translatedRight); } return assignment; @@ -461,6 +444,11 @@ protected override Expression VisitBlock(BlockExpression block) if (blockContext == ExpressionContext.Expression) { + if (_liftedState.Variables.ContainsKey(parameter)) + { + throw new NotSupportedException("Parameter clash during expression lifting for: " + parameter.Name); + } + _liftedState.Variables.Add(parameter, uniquifiedName); _liftedState.VariableNames.Add(uniquifiedName); } @@ -525,7 +513,7 @@ protected override Expression VisitBlock(BlockExpression block) var useExplicitVariableType = valueSyntax.Kind() == SyntaxKind.NullLiteralExpression; translated = useExplicitVariableType - ? _g.LocalDeclarationStatement(Translate(lValue.Type), LookupVariableName(lValue), valueSyntax) + ? _g.LocalDeclarationStatement(Generate(lValue.Type), LookupVariableName(lValue), valueSyntax) : _g.LocalDeclarationStatement(LookupVariableName(lValue), valueSyntax); } @@ -625,7 +613,7 @@ protected override Expression VisitBlock(BlockExpression block) // and either add them to the block, or lift them if we're an expression block. var unassignedVariableDeclarations = unassignedVariables.Select( - v => (LocalDeclarationStatementSyntax)_g.LocalDeclarationStatement(Translate(v.Type), LookupVariableName(v))); + v => (LocalDeclarationStatementSyntax)_g.LocalDeclarationStatement(Generate(v.Type), LookupVariableName(v))); if (blockContext == ExpressionContext.Expression) { @@ -743,7 +731,7 @@ protected virtual SyntaxNode TranslateCatchBlock(CatchBlock catchBlock, bool noT var catchDeclaration = noType ? null - : CatchDeclaration(Translate(catchBlock.Test)); + : CatchDeclaration(Generate(catchBlock.Test)); if (catchBlock.Variable is not null) { @@ -797,7 +785,7 @@ protected virtual CSharpSyntaxNode TranslateConditional( if (isFalseAbsent) { throw new NotSupportedException( - $"Missing {nameof(ConditionalExpression.IfFalse)} in {nameof(ConditionalExpression)} in expression context"); + $"Missing {nameof(System.Linq.Expressions.ConditionalExpression.IfFalse)} in {nameof(System.Linq.Expressions.ConditionalExpression)} in expression context"); } var parentLiftedState = _liftedState; @@ -819,7 +807,7 @@ protected virtual CSharpSyntaxNode TranslateConditional( if (_liftedState.Statements.Count == 0) { _liftedState = parentLiftedState; - return ConditionalExpression(test, ifTrueExpression, ifFalseExpression); + return ParenthesizedExpression(ConditionalExpression(test, ifTrueExpression, ifFalseExpression)); } } @@ -849,7 +837,7 @@ protected virtual CSharpSyntaxNode TranslateConditional( var name = UniquifyVariableName("liftedConditional"); var parameter = E.Parameter(conditional.Type, name); assignmentVariable = IdentifierName(name); - loweredAssignmentVariableType = Translate(parameter.Type); + loweredAssignmentVariableType = Generate(parameter.Type); } else { @@ -943,112 +931,146 @@ protected override Expression VisitConstant(ConstantExpression constant) Result = GenerateValue(constant.Value); return constant; + } - ExpressionSyntax GenerateValue(object? value) - => value switch - { - int or long or uint or ulong or short or sbyte or ushort or byte or double or float or decimal or char - => (ExpressionSyntax)_g.LiteralExpression(constant.Value), + /// + /// 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. + /// + protected virtual ExpressionSyntax GenerateValue(object? value) + { + if (_constantReplacements != null + && value != null + && _constantReplacements.TryGetValue(value, out var instance)) + { + return instance; + } - string or bool or null => (ExpressionSyntax)_g.LiteralExpression(constant.Value), + return value switch + { + int or long or uint or ulong or short or sbyte or ushort or byte or double or float or decimal or char + or string or bool or null + => (ExpressionSyntax)_g.LiteralExpression(value), - Type t => TypeOfExpression(Translate(t)), - Enum e => HandleEnum(e), + Type t => TypeOfExpression(Generate(t)), + Enum e => HandleEnum(e), - ITuple tuple - when tuple.GetType() is { IsGenericType: true } tupleType - && tupleType.Name.StartsWith("ValueTuple`", StringComparison.Ordinal) - && tupleType.Namespace == "System" - => HandleValueTuple(tuple), + Guid g => ObjectCreationExpression(IdentifierName(nameof(Guid))) + .WithArgumentList( + ArgumentList( + SingletonSeparatedList( + Argument( + LiteralExpression( + SyntaxKind.StringLiteralExpression, + Literal(g.ToString())))))), - IEqualityComparer c - when c == StructuralComparisons.StructuralEqualityComparer - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(StructuralComparisons)), - IdentifierName(nameof(StructuralComparisons.StructuralEqualityComparer))), + ITuple tuple + when tuple.GetType() is { IsGenericType: true } tupleType + && tupleType.Name.StartsWith("ValueTuple`", StringComparison.Ordinal) + && tupleType.Namespace == "System" + => HandleValueTuple(tuple), - CultureInfo cultureInfo when cultureInfo == CultureInfo.InvariantCulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.InvariantCulture))), + ReferenceEqualityComparer equalityComparer + when equalityComparer == ReferenceEqualityComparer.Instance + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(ReferenceEqualityComparer)), + IdentifierName(nameof(ReferenceEqualityComparer.Instance))), - CultureInfo cultureInfo when cultureInfo == CultureInfo.InstalledUICulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.InstalledUICulture))), + IEqualityComparer c + when c == StructuralComparisons.StructuralEqualityComparer + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(StructuralComparisons)), + IdentifierName(nameof(StructuralComparisons.StructuralEqualityComparer))), - CultureInfo cultureInfo when cultureInfo == CultureInfo.CurrentCulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.CurrentCulture))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.InvariantCulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.InvariantCulture))), - CultureInfo cultureInfo when cultureInfo == CultureInfo.CurrentUICulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.CurrentUICulture))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.InstalledUICulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.InstalledUICulture))), - CultureInfo cultureInfo when cultureInfo == CultureInfo.DefaultThreadCurrentCulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.DefaultThreadCurrentCulture))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.CurrentCulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.CurrentCulture))), - CultureInfo cultureInfo when cultureInfo == CultureInfo.DefaultThreadCurrentUICulture - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(CultureInfo)), - IdentifierName(nameof(CultureInfo.DefaultThreadCurrentUICulture))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.CurrentUICulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.CurrentUICulture))), - Encoding encoding when encoding == Encoding.ASCII - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.ASCII))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.DefaultThreadCurrentCulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.DefaultThreadCurrentCulture))), - Encoding encoding when encoding == Encoding.Unicode - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.Unicode))), + CultureInfo cultureInfo when cultureInfo == CultureInfo.DefaultThreadCurrentUICulture + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(CultureInfo)), + IdentifierName(nameof(CultureInfo.DefaultThreadCurrentUICulture))), - Encoding encoding when encoding == Encoding.BigEndianUnicode - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.BigEndianUnicode))), + Encoding encoding when encoding == Encoding.ASCII + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.ASCII))), - Encoding encoding when encoding == Encoding.UTF8 - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.UTF8))), + Encoding encoding when encoding == Encoding.Unicode + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.Unicode))), - Encoding encoding when encoding == Encoding.UTF32 - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.UTF32))), + Encoding encoding when encoding == Encoding.BigEndianUnicode + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.BigEndianUnicode))), - Encoding encoding when encoding == Encoding.Latin1 - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.Latin1))), + Encoding encoding when encoding == Encoding.UTF8 + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.UTF8))), - Encoding encoding when encoding == Encoding.Default - => MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - Translate(typeof(Encoding)), - IdentifierName(nameof(Encoding.Default))), + Encoding encoding when encoding == Encoding.UTF32 + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.UTF32))), - _ => throw new NotSupportedException( - $"Encountered a constant of unsupported type '{value.GetType().Name}'. Only primitive constant nodes are supported.") - }; + Encoding encoding when encoding == Encoding.Latin1 + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.Latin1))), + + Encoding encoding when encoding == Encoding.Default + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Encoding)), + IdentifierName(nameof(Encoding.Default))), + + FieldInfo fieldInfo + => HandleFieldInfo(fieldInfo), + + //TODO: Handle PropertyInfo + + _ => GenerateUnknownValue(value) + }; ExpressionSyntax HandleEnum(Enum e) { @@ -1063,7 +1085,7 @@ ExpressionSyntax HandleEnum(Enum e) var underlyingType = enumType.GetEnumUnderlyingType(); return CastExpression( - Translate(enumType), + Generate(enumType), LiteralExpression( SyntaxKind.NumericLiteralExpression, underlyingType == typeof(sbyte) @@ -1083,13 +1105,13 @@ ExpressionSyntax HandleEnum(Enum e) (last, next) => last is null ? MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(enumType.Name), + Generate(enumType), IdentifierName(next)) : BinaryExpression( SyntaxKind.BitwiseOrExpression, last, MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, - IdentifierName(enumType.Name), + Generate(enumType), IdentifierName(next))))!; } @@ -1103,6 +1125,47 @@ ExpressionSyntax HandleValueTuple(ITuple tuple) return TupleExpression(SeparatedList(arguments)); } + + ExpressionSyntax HandleFieldInfo(FieldInfo fieldInfo) + => fieldInfo.DeclaringType is null + ? throw new NotSupportedException("Field without a declaring type: " + fieldInfo.Name) + : (ExpressionSyntax)InvocationExpression( + MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + TypeOfExpression(Generate(fieldInfo.DeclaringType)), + IdentifierName(nameof(Type.GetField))), + ArgumentList( + SeparatedList(new[] { + Argument(LiteralExpression( + SyntaxKind.StringLiteralExpression, + Literal(fieldInfo.Name))), + Argument(BinaryExpression( + SyntaxKind.BitwiseOrExpression, + HandleEnum(fieldInfo.IsStatic ? BindingFlags.Static : BindingFlags.Instance), + BinaryExpression( + SyntaxKind.BitwiseOrExpression, + HandleEnum(fieldInfo.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic), + HandleEnum(BindingFlags.DeclaredOnly)))) }))); + } + + /// + /// 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. + /// + protected virtual ExpressionSyntax GenerateUnknownValue(object value) + { + var type = value.GetType(); + if (type.IsValueType + && value.Equals(type.GetDefaultValue())) + { + return DefaultExpression(Generate(type)); + } + + throw new NotSupportedException( + $"Encountered a constant of unsupported type '{value.GetType().Name}'. Only primitive constant nodes are supported." + + Environment.NewLine + value); } /// @@ -1112,7 +1175,7 @@ protected override Expression VisitDebugInfo(DebugInfoExpression node) /// protected override Expression VisitDefault(DefaultExpression node) { - Result = DefaultExpression(Translate(node.Type)); + Result = DefaultExpression(Generate(node.Type)); return node; } @@ -1203,13 +1266,45 @@ protected virtual IdentifierNameSyntax TranslateLabelTarget(LabelTarget labelTar return IdentifierName(_stack.Peek().Labels[labelTarget]); } - private TypeSyntax Translate(Type type) + /// + /// 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. + /// + protected virtual TypeSyntax Generate(Type type) { if (type.IsGenericType) { - return GenericName( + // This should produce terser code, but currently gets broken by the Simplifier + //if (type.IsConstructedGenericType + // && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + //{ + // return NullableType(Translate(type.GenericTypeArguments[0])); + //} + + var generic = GenericName( Identifier(type.Name.Substring(0, type.Name.IndexOf('`'))), - TypeArgumentList(SeparatedList(type.GenericTypeArguments.Select(Translate)))); + TypeArgumentList(SeparatedList(type.GenericTypeArguments.Select(Generate)))); + if (type.IsNested) + { + return QualifiedName( + (NameSyntax)Generate(type.DeclaringType!), + generic); + } + + if (type.Namespace != null) + { + _collectedNamespaces.Add(type.Namespace); + } + + return generic; + } + + if (type.IsArray) + { + return ArrayType(Generate(type.GetElementType()!)) + .WithRankSpecifiers(SingletonList(ArrayRankSpecifier(SingletonSeparatedList(OmittedArraySizeExpression())))); } if (type == typeof(string)) @@ -1295,7 +1390,7 @@ private TypeSyntax Translate(Type type) if (type.IsNested) { return QualifiedName( - (NameSyntax)Translate(type.DeclaringType!), + (NameSyntax)Generate(type.DeclaringType!), IdentifierName(type.Name)); } @@ -1346,7 +1441,7 @@ protected override Expression VisitLambda(Expression lambda) lambda.Parameters.Select( p => Parameter(Identifier(LookupVariableName(p))) - .WithType(p.Type.IsAnonymousType() ? null : Translate(p.Type))))), + .WithType(p.Type.IsAnonymousType() ? null : Generate(p.Type))))), body); var popped = _stack.Pop(); @@ -1417,31 +1512,10 @@ protected override Expression VisitMember(MemberExpression member) { using var _ = ChangeContext(ExpressionContext.Expression); - // LINQ expression trees can directly access private members, but C# code cannot; render (slow) reflection code that does the same - // thing. Note that assignment to private members is handled in VisitBinary. - // TODO: Replace this with a more efficient UnsafeAccessor API. #29754 switch (member) { - case { Member: FieldInfo { IsPrivate: true } fieldInfo }: - if (member.Expression is null) - { - throw new NotImplementedException("Private static field access"); - } - - if (member.Member.DeclaringType is null) - { - throw new NotSupportedException("Private field without a declaring type: " + member.Member.Name); - } - - Result = Translate( - E.Call( - E.Call( - E.Constant(member.Member.DeclaringType), - _typeGetFieldMethod ??= typeof(Type).GetMethod(nameof(Type.GetField), [typeof(string), typeof(BindingFlags)])!, - E.Constant(fieldInfo.Name), - E.Constant(BindingFlags.NonPublic | BindingFlags.Instance)), - _fieldGetValueMethod ??= typeof(FieldInfo).GetMethod(nameof(FieldInfo.GetValue), [typeof(object)])!, - member.Expression)); + case { Member: FieldInfo { IsPublic: false } }: + TranslateNonPublicFieldAccess(member); break; // TODO: private property @@ -1458,7 +1532,7 @@ when constantExpression.Type.Attributes.HasFlag(TypeAttributes.NestedPrivate) Result = MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, member.Expression is null - ? Translate(member.Member.DeclaringType!) // static + ? Generate(member.Member.DeclaringType!) // static : Translate(member.Expression), IdentifierName(member.Member.Name)); break; @@ -1467,6 +1541,55 @@ member.Expression is null return member; } + /// + /// 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. + /// + protected virtual void TranslateNonPublicFieldAccess(MemberExpression member) + { + if (member.Expression is null) + { + throw new NotImplementedException("Private static field access"); + } + + var translatedExpression = Translate(member.Expression); + Result = ParenthesizedExpression( + CastExpression( + Generate(member.Type), + InvocationExpression( + MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + GenerateValue(member.Member), + IdentifierName(nameof(FieldInfo.GetValue))), + ArgumentList( + SingletonSeparatedList(Argument(translatedExpression)))))); + } + + /// + /// 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. + /// + protected virtual void TranslateNonPublicFieldAssignment(MemberExpression member, Expression value) + { + // LINQ expression trees can directly access private members, but C# code cannot, use SetValue instead. + if (member.Expression is null) + { + throw new NotImplementedException("Private static field assignment"); + } + + Result = InvocationExpression( + MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + GenerateValue(member.Member), + IdentifierName(nameof(FieldInfo.SetValue))), + ArgumentList( + SeparatedList(new[] { Argument(Translate(member.Expression)), Argument(Translate(value)) }))); + } + /// protected override Expression VisitIndex(IndexExpression index) { @@ -1518,7 +1641,7 @@ protected override Expression VisitMethodCall(MethodCallExpression call) Identifier(call.Method.Name), TypeArgumentList( SeparatedList( - call.Method.GetGenericArguments().Select(Translate)))); + call.Method.GetGenericArguments().Select(Generate)))); } // Extension syntax @@ -1549,7 +1672,7 @@ protected override Expression VisitMethodCall(MethodCallExpression call) ExpressionSyntax GetMemberAccessesForAllDeclaringTypes(Type type) => type.DeclaringType is null - ? Translate(type) + ? Generate(type) : MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, GetMemberAccessesForAllDeclaringTypes(type.DeclaringType), @@ -1620,7 +1743,7 @@ protected override Expression VisitNewArray(NewArrayExpression newArray) { using var _ = ChangeContext(ExpressionContext.Expression); - var elementType = Translate(newArray.Type.GetElementType()!); + var elementType = Generate(newArray.Type.GetElementType()!); var expressions = TranslateList(newArray.Expressions); if (newArray.NodeType == ExpressionType.NewArrayBounds) @@ -1698,7 +1821,7 @@ protected override Expression VisitNew(NewExpression node) { // Normal case with plain old instantiation Result = ObjectCreationExpression( - Translate(node.Type), + Generate(node.Type), ArgumentList(SeparatedList(arguments)), initializer: null); } @@ -1863,7 +1986,7 @@ SyntaxList ProcessArmBody(Expression body) var name = UniquifyVariableName("liftedSwitch"); var parameter = E.Parameter(switchNode.Type, name); assignmentVariable = IdentifierName(name); - loweredAssignmentVariableType = Translate(parameter.Type); + loweredAssignmentVariableType = Generate(parameter.Type); } else { @@ -2024,10 +2147,10 @@ protected override Expression VisitTypeBinary(TypeBinaryExpression node) Result = node.NodeType switch { ExpressionType.TypeIs - => BinaryExpression(SyntaxKind.IsExpression, visitedExpression, Translate(node.TypeOperand)), + => BinaryExpression(SyntaxKind.IsExpression, visitedExpression, Generate(node.TypeOperand)), ExpressionType.TypeEqual - => BinaryExpression(SyntaxKind.EqualsExpression, visitedExpression, TypeOfExpression(Translate(node.TypeOperand))), + => BinaryExpression(SyntaxKind.EqualsExpression, visitedExpression, TypeOfExpression(Generate(node.TypeOperand))), _ => throw new ArgumentOutOfRangeException() }; @@ -2063,12 +2186,12 @@ protected override Expression VisitUnary(UnaryExpression unary) ExpressionType.IsFalse => _g.LogicalNotExpression(operand), ExpressionType.IsTrue => operand, ExpressionType.ArrayLength => _g.MemberAccessExpression(operand, "Length"), - ExpressionType.Convert => ParenthesizedExpression((ExpressionSyntax)_g.ConvertExpression(Translate(unary.Type), operand)), + ExpressionType.Convert => ParenthesizedExpression((ExpressionSyntax)_g.ConvertExpression(Generate(unary.Type), operand)), ExpressionType.ConvertChecked => - ParenthesizedExpression((ExpressionSyntax)_g.ConvertExpression(Translate(unary.Type), operand)), + ParenthesizedExpression((ExpressionSyntax)_g.ConvertExpression(Generate(unary.Type), operand)), ExpressionType.Throw when unary.Type == typeof(void) => _g.ThrowStatement(operand), ExpressionType.Throw => _g.ThrowExpression(operand), - ExpressionType.TypeAs => BinaryExpression(SyntaxKind.AsExpression, operand, Translate(unary.Type)), + ExpressionType.TypeAs => BinaryExpression(SyntaxKind.AsExpression, operand, Generate(unary.Type)), ExpressionType.Quote => operand, ExpressionType.UnaryPlus => PrefixUnaryExpression(SyntaxKind.UnaryPlusExpression, operand), ExpressionType.Unbox => operand, diff --git a/src/EFCore.Design/Query/Internal/RuntimeModelLinqToCSharpSyntaxTranslator.cs b/src/EFCore.Design/Query/Internal/RuntimeModelLinqToCSharpSyntaxTranslator.cs new file mode 100644 index 00000000000..f0f30f54861 --- /dev/null +++ b/src/EFCore.Design/Query/Internal/RuntimeModelLinqToCSharpSyntaxTranslator.cs @@ -0,0 +1,134 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// ReSharper disable once CheckNamespace + +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Editing; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; +using Microsoft.EntityFrameworkCore.Design.Internal; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; + +namespace Microsoft.EntityFrameworkCore.Query.Internal; + +/// +/// 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. +/// +public class RuntimeModelLinqToCSharpSyntaxTranslator : LinqToCSharpSyntaxTranslator +{ + private Dictionary? _memberAccessReplacements; + + /// + /// 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. + /// + public RuntimeModelLinqToCSharpSyntaxTranslator(SyntaxGenerator syntaxGenerator) : base(syntaxGenerator) + { + } + + /// + /// 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. + /// + public virtual SyntaxNode TranslateStatement( + Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces) + { + _memberAccessReplacements = memberAccessReplacements; + var result = TranslateStatement(node, constantReplacements, collectedNamespaces); + _memberAccessReplacements = null; + return result; + } + + /// + /// 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. + /// + public virtual SyntaxNode TranslateExpression( + Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces) + { + _memberAccessReplacements = memberAccessReplacements; + var result = TranslateExpression(node, constantReplacements, collectedNamespaces); + _memberAccessReplacements = null; + return result; + } + + /// + /// 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. + /// + protected override ExpressionSyntax GenerateValue(object? value) + => value switch + { + Snapshot snapshot + when snapshot == Snapshot.Empty + => MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + Generate(typeof(Snapshot)), + IdentifierName(nameof(Snapshot.Empty))), + + _ => base.GenerateValue(value) + }; + + /// + /// 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. + /// + protected override void TranslateNonPublicFieldAccess(MemberExpression member) + { + if (_memberAccessReplacements?.TryGetValue(new MemberAccess(member.Member, assignment: false), out var methodName) == true) + { + Result = InvocationExpression( + methodName, + ArgumentList(SeparatedList(new[] { Argument(Translate(member.Expression)) }))); + } + else + { + base.TranslateNonPublicFieldAccess(member); + } + } + + /// + /// 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. + /// + protected override void TranslateNonPublicFieldAssignment(MemberExpression member, Expression value) + { + if (_memberAccessReplacements?.TryGetValue(new MemberAccess(member.Member, assignment: true), out var methodName) == true) + { + Result = InvocationExpression( + methodName, + ArgumentList(SeparatedList(new[] + { + Argument(Translate(member.Expression)), + Argument(Translate(value)) + }))); + } + else + { + base.TranslateNonPublicFieldAssignment(member, value); + } + } +} diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpRuntimeModelCodeGenerator.cs b/src/EFCore.Design/Scaffolding/Internal/CSharpRuntimeModelCodeGenerator.cs index ce13fabe048..007b2d072b7 100644 --- a/src/EFCore.Design/Scaffolding/Internal/CSharpRuntimeModelCodeGenerator.cs +++ b/src/EFCore.Design/Scaffolding/Internal/CSharpRuntimeModelCodeGenerator.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.CompilerServices; using System.Text; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Design.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -64,18 +66,18 @@ public virtual IReadOnlyCollection GenerateModel( var modelFileName = options.ContextType.ShortDisplayName() + ModelSuffix + FileExtension; scaffoldedFiles.Add(new ScaffoldedFile { Path = modelFileName, Code = modelCode }); - var entityTypeIds = new Dictionary(); + var configurationClassNames = new Dictionary(); var modelBuilderCode = CreateModelBuilder( - model, options.ModelNamespace, options.ContextType, entityTypeIds, nullable); + model, options.ModelNamespace, options.ContextType, configurationClassNames, nullable); var modelBuilderFileName = options.ContextType.ShortDisplayName() + ModelBuilderSuffix + FileExtension; scaffoldedFiles.Add(new ScaffoldedFile { Path = modelBuilderFileName, Code = modelBuilderCode }); - foreach (var (entityType, (_, @class)) in entityTypeIds) + foreach (var entityType in model.GetEntityTypesInHierarchicalOrder()) { var generatedCode = GenerateEntityType( - entityType, options.ModelNamespace, @class, nullable); + entityType, options.ModelNamespace, configurationClassNames, nullable); - var entityTypeFileName = @class + FileExtension; + var entityTypeFileName = configurationClassNames[entityType] + FileExtension; scaffoldedFiles.Add(new ScaffoldedFile { Path = entityTypeFileName, Code = generatedCode }); } @@ -202,7 +204,7 @@ private string CreateModelBuilder( IModel model, string @namespace, Type contextType, - Dictionary entityTypeIds, + Dictionary configurationClassNames, bool nullable) { var mainBuilder = new IndentedStringBuilder(); @@ -260,6 +262,7 @@ private string CreateModelBuilder( { var entityTypes = model.GetEntityTypesInHierarchicalOrder(); var variables = new HashSet(); + var scopeVariables = new Dictionary(); var anyEntityTypes = false; foreach (var entityType in entityTypes) @@ -272,7 +275,8 @@ private string CreateModelBuilder( ? EntityTypeSuffix + variableName[1..] : char.ToUpperInvariant(firstChar) + variableName[(variableName[0] == '@' ? 2 : 1)..] + EntityTypeSuffix; - entityTypeIds[entityType] = (variableName, entityClassName); + configurationClassNames[entityType] = entityClassName; + scopeVariables[entityType] = variableName; mainBuilder .Append("var ") @@ -285,7 +289,7 @@ private string CreateModelBuilder( { mainBuilder .Append(", ") - .Append(entityTypeIds[entityType.BaseType].Variable); + .Append(scopeVariables[entityType.BaseType]); } mainBuilder @@ -298,21 +302,20 @@ private string CreateModelBuilder( } var anyForeignKeys = false; - foreach (var (entityType, namePair) in entityTypeIds) + foreach (var entityType in entityTypes) { var foreignKeyNumber = 1; - var (variableName, entityClassName) = namePair; foreach (var foreignKey in entityType.GetDeclaredForeignKeys()) { anyForeignKeys = true; - var principalVariable = entityTypeIds[foreignKey.PrincipalEntityType].Variable; + var principalVariable = scopeVariables[foreignKey.PrincipalEntityType]; mainBuilder - .Append(entityClassName) + .Append(configurationClassNames[entityType]) .Append(".CreateForeignKey") .Append(foreignKeyNumber++.ToString()) .Append("(") - .Append(variableName) + .Append(scopeVariables[entityType]) .Append(", ") .Append(principalVariable) .AppendLine(");"); @@ -325,22 +328,21 @@ private string CreateModelBuilder( } var anySkipNavigations = false; - foreach (var (entityType, namePair) in entityTypeIds) + foreach (var entityType in entityTypes) { var navigationNumber = 1; - var (variableName, entityClassName) = namePair; foreach (var navigation in entityType.GetDeclaredSkipNavigations()) { anySkipNavigations = true; - var targetVariable = entityTypeIds[navigation.TargetEntityType].Variable; - var joinVariable = entityTypeIds[navigation.JoinEntityType].Variable; + var targetVariable = scopeVariables[navigation.TargetEntityType]; + var joinVariable = scopeVariables[navigation.JoinEntityType]; mainBuilder - .Append(entityClassName) + .Append(configurationClassNames[entityType]) .Append(".CreateSkipNavigation") .Append(navigationNumber++.ToString()) .Append("(") - .Append(variableName) + .Append(scopeVariables[entityType]) .Append(", ") .Append(targetVariable) .Append(", ") @@ -354,15 +356,13 @@ private string CreateModelBuilder( mainBuilder.AppendLine(); } - foreach (var (_, namePair) in entityTypeIds) + foreach (var (entityType, entityClassName) in configurationClassNames) { - var (variableName, entityClassName) = namePair; - mainBuilder .Append(entityClassName) .Append(".CreateAnnotations") .Append("(") - .Append(variableName) + .Append(scopeVariables[entityType]) .AppendLine(");"); } @@ -378,6 +378,7 @@ private string CreateModelBuilder( methodBuilder, namespaces, variables, + configurationClassNames, nullable); foreach (var typeConfiguration in model.GetTypeMappingConfigurations()) @@ -484,7 +485,7 @@ private void Create( mainBuilder.AppendLine(); } - private string GenerateEntityType(IEntityType entityType, string @namespace, string className, bool nullable) + private string GenerateEntityType(IEntityType entityType, string @namespace, Dictionary entityClassNames, bool nullable) { var mainBuilder = new IndentedStringBuilder(); var methodBuilder = new IndentedStringBuilder(); @@ -501,31 +502,38 @@ private string GenerateEntityType(IEntityType entityType, string @namespace, str mainBuilder.Indent(); } + var className = entityClassNames[entityType]; mainBuilder .Append("internal partial class ").AppendLine(className) .AppendLine("{"); using (mainBuilder.Indent()) { - CreateEntityType(entityType, mainBuilder, methodBuilder, namespaces, className, nullable); + CreateEntityType(entityType, mainBuilder, methodBuilder, namespaces, entityClassNames, nullable); foreach (var complexProperty in entityType.GetDeclaredComplexProperties()) { - CreateComplexProperty(complexProperty, mainBuilder, methodBuilder, namespaces, className, nullable); + CreateComplexProperty(complexProperty, mainBuilder, methodBuilder, namespaces, entityClassNames, className, nullable); } var foreignKeyNumber = 1; foreach (var foreignKey in entityType.GetDeclaredForeignKeys()) { - CreateForeignKey(foreignKey, foreignKeyNumber++, mainBuilder, methodBuilder, namespaces, className, nullable); + CreateForeignKey(foreignKey, foreignKeyNumber++, mainBuilder, methodBuilder, namespaces, entityClassNames, className, nullable); } var navigationNumber = 1; foreach (var navigation in entityType.GetDeclaredSkipNavigations()) { - CreateSkipNavigation(navigation, navigationNumber++, mainBuilder, methodBuilder, namespaces, className, nullable); + CreateSkipNavigation(navigation, navigationNumber++, mainBuilder, methodBuilder, namespaces, entityClassNames, className, nullable); } - CreateAnnotations(entityType, mainBuilder, methodBuilder, namespaces, className, nullable); + CreateAnnotations(entityType, mainBuilder, methodBuilder, namespaces, entityClassNames, nullable); + + var methods = methodBuilder.ToString(); + if (!string.IsNullOrEmpty(methods)) + { + mainBuilder.AppendLines(methods); + } } mainBuilder.AppendLine("}"); @@ -536,7 +544,7 @@ private string GenerateEntityType(IEntityType entityType, string @namespace, str mainBuilder.AppendLine("}"); } - return GenerateHeader(namespaces, @namespace, nullable) + mainBuilder + methodBuilder; + return GenerateHeader(namespaces, @namespace, nullable) + mainBuilder; } private void CreateEntityType( @@ -544,7 +552,7 @@ private void CreateEntityType( IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet namespaces, - string className, + Dictionary configurationClassNames, bool nullable) { mainBuilder @@ -560,6 +568,7 @@ private void CreateEntityType( mainBuilder.AppendLine(" baseEntityType = null)") .AppendLine("{"); + var className = configurationClassNames[entityType]; using (mainBuilder.Indent()) { const string entityTypeVariable = "runtimeEntityType"; @@ -577,14 +586,15 @@ private void CreateEntityType( methodBuilder, namespaces, variables, + configurationClassNames, nullable); Create(entityType, parameters); - var propertyVariables = new Dictionary(); + var propertyVariables = new Dictionary(); foreach (var property in entityType.GetDeclaredProperties()) { - Create(property, propertyVariables, parameters); + Create(property, propertyVariables, memberAccessReplacements: null, parameters); } foreach (var property in entityType.GetDeclaredServiceProperties()) @@ -804,13 +814,13 @@ private void Create(IEntityType entityType, CSharpRuntimeAnnotationCodeGenerator private void Create( IProperty property, - Dictionary propertyVariables, + Dictionary constantReplacements, + Dictionary? memberAccessReplacements, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) { var variableName = _code.Identifier(property.Name, parameters.ScopeVariables, capitalize: false); - propertyVariables[property] = variableName; - Create(property, variableName, propertyVariables, parameters); + Create(property, variableName, constantReplacements, memberAccessReplacements, parameters); CreateAnnotations( property, @@ -823,7 +833,8 @@ private void Create( private void Create( IProperty property, string variableName, - Dictionary propertyVariables, + Dictionary constantReplacements, + Dictionary? memberAccessReplacements, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) { var valueGeneratorFactoryType = (Type?)property[CoreAnnotationNames.ValueGeneratorFactoryType]; @@ -841,7 +852,7 @@ private void Create( .IncrementIndent() .Append(_code.Literal(property.Name)); - PropertyBaseParameters(property, parameters); + GeneratePropertyBaseParameters(property, parameters); if (property.IsNullable) { @@ -982,10 +993,27 @@ private void Create( .AppendLine(");") .DecrementIndent(); + var propertyParameters = parameters with { TargetName = variableName }; + + SetPropertyBaseProperties(property, constantReplacements, memberAccessReplacements, propertyParameters); + mainBuilder.Append(variableName).Append(".TypeMapping = "); - _annotationCodeGenerator.Create(property.GetTypeMapping(), property, parameters with { TargetName = variableName }); + _annotationCodeGenerator.Create(property.GetTypeMapping(), property, propertyParameters); mainBuilder.AppendLine(";"); + if (property.IsKey() + || property.IsForeignKey() + || property.IsUniqueIndex()) + { + var currentComparerType = CurrentValueComparerFactory.Instance.GetComparerType(property); + AddNamespace(currentComparerType, parameters.Namespaces); + + mainBuilder + .Append(variableName).Append(".SetCurrentValueComparer(new ") + .Append(_code.Reference(currentComparerType)) + .AppendLine($"({variableName}));"); + } + if (sentinel != null && converter != null) { @@ -995,6 +1023,193 @@ private void Create( } } + private void + SetPropertyBaseProperties( + IPropertyBase property, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + var variableName = parameters.TargetName; + var mainBuilder = parameters.MainBuilder; + constantReplacements ??= []; + constantReplacements[property] = variableName; + if (!property.IsShadowProperty()) + { + memberAccessReplacements = CreatePrivateAccessors(property, memberAccessReplacements, parameters); + + ClrPropertyGetterFactory.Instance.Create( + property, + out var getterExpression, + out var hasSentinelExpression, + out var structuralGetterExpression, + out var hasStructuralSentinelExpression); + + mainBuilder + .Append(variableName).AppendLine(".SetGetter(") + .IncrementIndent() + .AppendLines(_code.Expression(getterExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(_code.Expression(hasSentinelExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(_code.Expression(structuralGetterExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(_code.Expression(hasStructuralSentinelExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + ClrPropertySetterFactory.Instance.Create(property, out var setterExpression); + + mainBuilder + .Append(variableName).AppendLine(".SetSetter(") + .IncrementIndent() + .AppendLines(_code.Expression(setterExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + ClrPropertyMaterializationSetterFactory.Instance.Create(property, out var materializationSetterExpression); + + mainBuilder + .Append(variableName).AppendLine(".SetMaterializationSetter(") + .IncrementIndent() + .AppendLines(_code.Expression(materializationSetterExpression, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + PropertyAccessorsFactory.Instance.Create(property, + out var currentValueGetter, + out var preStoreGeneratedCurrentValueGetter, + out var originalValueGetter, + out var relationshipSnapshotGetter, + out var valueBufferGetter); + + mainBuilder + .Append(variableName).AppendLine(".SetAccessors(") + .IncrementIndent() + .AppendLines(_code.Expression(currentValueGetter, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(_code.Expression(preStoreGeneratedCurrentValueGetter, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(originalValueGetter == null + ? "null" + : _code.Expression(originalValueGetter, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(_code.Expression(relationshipSnapshotGetter, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(valueBufferGetter == null + ? "null" + : _code.Expression(valueBufferGetter, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + } + + var propertyIndexes = ((IRuntimePropertyBase)property).PropertyIndexes; + mainBuilder + .Append(variableName).AppendLine(".SetPropertyIndexes(") + .IncrementIndent() + .Append("index: ").Append(_code.Literal(propertyIndexes.Index)).AppendLine(",") + .Append("originalValueIndex: ").Append(_code.Literal(propertyIndexes.OriginalValueIndex)).AppendLine(",") + .Append("shadowIndex: ").Append(_code.Literal(propertyIndexes.ShadowIndex)).AppendLine(",") + .Append("relationshipIndex: ").Append(_code.Literal(propertyIndexes.RelationshipIndex)).AppendLine(",") + .Append("storeGenerationIndex: ").Append(_code.Literal(propertyIndexes.StoreGenerationIndex)).AppendLine(");") + .DecrementIndent(); + } + + private Dictionary? CreatePrivateAccessors( + IPropertyBase property, + Dictionary? memberAccessReplacements, + CSharpRuntimeAnnotationCodeGeneratorParameters parameters, + bool create = true, + bool qualify = false) + { + if (property.IsShadowProperty() + || property.IsIndexerProperty()) + { + return memberAccessReplacements; + } + + memberAccessReplacements = CreatePrivateAccessor(property, forMaterialization: false, forSet: false, create, qualify, memberAccessReplacements, parameters); + memberAccessReplacements = CreatePrivateAccessor(property, forMaterialization: false, forSet: true, create, qualify, memberAccessReplacements, parameters); + memberAccessReplacements = CreatePrivateAccessor(property, forMaterialization: true, forSet: false, create, qualify, memberAccessReplacements, parameters); + memberAccessReplacements = CreatePrivateAccessor(property, forMaterialization: true, forSet: true, create, qualify, memberAccessReplacements, parameters); + + return memberAccessReplacements; + } + + private Dictionary? CreatePrivateAccessor( + IPropertyBase property, + bool forMaterialization, + bool forSet, + bool create, + bool qualify, + Dictionary? memberAccessReplacements, + CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + var member = property.GetMemberInfo(forMaterialization, forSet); + if (member is not FieldInfo field + || field.IsPublic) + { + return memberAccessReplacements; + } + + if (memberAccessReplacements?.ContainsKey(new MemberAccess(member, forSet)) != true) + { + memberAccessReplacements ??= []; + + var methodName = (forSet ? "Write" : "Read") + property.Name; + if (create) + { + var methodBuilder = parameters.MethodBuilder; + if (!memberAccessReplacements.ContainsKey(new MemberAccess(member, !forSet))) + { + AddNamespace(typeof(UnsafeAccessorAttribute), parameters.Namespaces); + methodBuilder + .AppendLine() + .AppendLine($"[UnsafeAccessor(UnsafeAccessorKind.Field, Name = \"{field.Name}\")]") + .Append($"extern static ref {_code.Reference(member.GetMemberType())} Get{property.Name}(") + .AppendLine($"{_code.Reference(property.DeclaringType.ClrType)} @this);"); + } + + // Expression trees cannot contain calls to methods that have a ref return, so we need to wrap the call + // This approach will not work if the declaring type of the member is a value type + + methodBuilder + .AppendLine() + .Append($"public static {(forSet ? "void" : _code.Reference(member.GetMemberType()))} {methodName}(") + .Append($"{_code.Reference(property.DeclaringType.ClrType)} @this"); + if (forSet) + { + methodBuilder + .Append($", {_code.Reference(member.GetMemberType())} value"); + } + + methodBuilder + .AppendLine(")") + .IncrementIndent() + .Append($"=> Get{property.Name}(@this)"); + + if (forSet) + { + methodBuilder + .Append(" = value"); + } + + methodBuilder + .AppendLine(";") + .DecrementIndent(); + } + + if (qualify) + { + methodName = parameters.ConfigurationClassNames[property.DeclaringType] + "." + methodName; + } + + memberAccessReplacements.Add(new MemberAccess(field, forSet), methodName); + } + + return memberAccessReplacements; + } + private static Type? GetValueConverterType(IProperty property) { var annotation = property.FindAnnotation(CoreAnnotationNames.ValueConverterType); @@ -1004,7 +1219,7 @@ private void Create( .ValueConverterType; } - private void PropertyBaseParameters( + private void GeneratePropertyBaseParameters( IPropertyBase property, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, bool skipType = false) @@ -1077,7 +1292,7 @@ private void FindProperties( IEnumerable properties, IndentedStringBuilder mainBuilder, bool nullable, - Dictionary? propertyVariables = null) + Dictionary? propertyVariables = null) { mainBuilder.Append("new[] { "); var first = true; @@ -1128,7 +1343,7 @@ private void Create( .IncrementIndent() .Append(_code.Literal(property.Name)); - PropertyBaseParameters(property, parameters, skipType: true); + GeneratePropertyBaseParameters(property, parameters, skipType: true); AddNamespace(property.ClrType, parameters.Namespaces); mainBuilder @@ -1139,17 +1354,18 @@ private void Create( .AppendLine(");") .DecrementIndent(); - CreateAnnotations( - property, - _annotationCodeGenerator.Generate, - parameters with { TargetName = variableName }); + var propertyParameters = parameters with { TargetName = variableName }; + + // Service properties don't use property accessors, so don't generate them + + CreateAnnotations(property, _annotationCodeGenerator.Generate, propertyParameters); mainBuilder.AppendLine(); } private void Create( IKey key, - Dictionary propertyVariables, + Dictionary propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, bool nullable) { @@ -1183,7 +1399,7 @@ private void Create( private void Create( IIndex index, - Dictionary propertyVariables, + Dictionary propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, bool nullable) { @@ -1227,17 +1443,21 @@ private void CreateComplexProperty( IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet namespaces, + Dictionary configurationClassNames, string topClassName, bool nullable) { + var className = _code.Identifier(complexProperty.Name, capitalize: true); mainBuilder .AppendLine() - .Append("private static class ") - .Append(_code.Identifier(complexProperty.Name, capitalize: true)) + .Append("public static class ") + .Append(className) .AppendLine("ComplexProperty") .AppendLine("{"); + methodBuilder = new IndentedStringBuilder(); var complexType = complexProperty.ComplexType; + configurationClassNames[complexType] = configurationClassNames[complexProperty.DeclaringType] + "." + className; using (mainBuilder.Indent()) { var declaringTypeVariable = "declaringType"; @@ -1281,9 +1501,10 @@ private void CreateComplexProperty( methodBuilder, namespaces, variables, + configurationClassNames, nullable); - PropertyBaseParameters(complexProperty, parameters, skipType: true); + GeneratePropertyBaseParameters(complexProperty, parameters, skipType: true); if (complexProperty.IsNullable) { @@ -1347,10 +1568,21 @@ private void CreateComplexProperty( .Append(complexPropertyVariable).AppendLine(".ComplexType;"); var complexTypeParameters = parameters with { TargetName = complexTypeVariable }; - var propertyVariables = new Dictionary(); + var complexPropertyParameters = parameters with { TargetName = complexPropertyVariable }; + + var constantReplacements = new Dictionary(); + Dictionary? memberAccessReplacements = null; + + foreach (var chainedComplexProperty in complexProperty.GetChainToComplexProperty()) + { + memberAccessReplacements = CreatePrivateAccessors(chainedComplexProperty, memberAccessReplacements, complexTypeParameters, create: chainedComplexProperty == complexProperty); + } + + SetPropertyBaseProperties(complexProperty, constantReplacements, memberAccessReplacements, complexPropertyParameters); + foreach (var property in complexType.GetProperties()) { - Create(property, propertyVariables, complexTypeParameters); + Create(property, constantReplacements, memberAccessReplacements, complexTypeParameters); } foreach (var nestedComplexProperty in complexType.GetComplexProperties()) @@ -1364,15 +1596,8 @@ private void CreateComplexProperty( .AppendLine(");"); } - CreateAnnotations( - complexType, - _annotationCodeGenerator.Generate, - complexTypeParameters); - - CreateAnnotations( - complexProperty, - _annotationCodeGenerator.Generate, - parameters with { TargetName = complexPropertyVariable }); + CreateAnnotations(complexType, _annotationCodeGenerator.Generate, complexTypeParameters); + CreateAnnotations(complexProperty, _annotationCodeGenerator.Generate, complexPropertyParameters); mainBuilder .Append("return ") @@ -1387,10 +1612,16 @@ private void CreateComplexProperty( { foreach (var nestedComplexProperty in complexType.GetComplexProperties()) { - CreateComplexProperty(nestedComplexProperty, mainBuilder, methodBuilder, namespaces, topClassName, nullable); + CreateComplexProperty(nestedComplexProperty, mainBuilder, methodBuilder, namespaces, configurationClassNames, topClassName, nullable); } } + var methods = methodBuilder.ToString(); + if (!string.IsNullOrEmpty(methods)) + { + mainBuilder.AppendLines(methods); + } + mainBuilder.AppendLine("}"); } @@ -1400,6 +1631,7 @@ private void CreateForeignKey( IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet namespaces, + Dictionary configurationClassNames, string className, bool nullable) { @@ -1487,6 +1719,7 @@ private void CreateForeignKey( methodBuilder, namespaces, variables, + configurationClassNames, nullable); var navigation = foreignKey.DependentToPrincipal; @@ -1530,7 +1763,7 @@ private void Create( .Append(foreignKeyVariable).AppendLine(",") .Append("onDependent: ").Append(_code.Literal(navigation.IsOnDependent)); - PropertyBaseParameters(navigation, parameters); + GeneratePropertyBaseParameters(navigation, parameters); if (navigation.IsEagerLoaded) { @@ -1549,10 +1782,66 @@ private void Create( .AppendLine() .DecrementIndent(); - CreateAnnotations( + var navigationParameters = parameters with { TargetName = navigationVariable }; + + var constantReplacements = new Dictionary(); + var memberAccessReplacements = CreatePrivateAccessors(navigation, null, navigationParameters, create: false, qualify: true); + SetPropertyBaseProperties(navigation, constantReplacements, memberAccessReplacements, navigationParameters); + + SetNavigationBaseProperties(navigation, constantReplacements, memberAccessReplacements, navigationParameters); + + CreateAnnotations(navigation, _annotationCodeGenerator.Generate, navigationParameters); + } + + private void SetNavigationBaseProperties( + INavigationBase navigation, + Dictionary constantReplacements, + Dictionary? memberAccessReplacements, + CSharpRuntimeAnnotationCodeGeneratorParameters parameters) + { + if (!navigation.IsCollection) + { + return; + } + + var mainBuilder = parameters.MainBuilder; + ClrCollectionAccessorFactory.Instance.Create( navigation, - _annotationCodeGenerator.Generate, - parameters with { TargetName = navigationVariable }); + out var entityType, + out var propertyType, + out var elementType, + out var getCollection, + out var setCollection, + out var setCollectionForMaterialization, + out var createAndSetCollection, + out var createCollection); + + AddNamespace(propertyType, parameters.Namespaces); + mainBuilder + .Append(parameters.TargetName) + .AppendLine($".SetCollectionAccessor<{_code.Reference(entityType)}, {_code.Reference(propertyType)}, {_code.Reference(elementType)}>(") + .IncrementIndent() + .AppendLines(getCollection == null + ? "null" + : _code.Expression(getCollection, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(setCollection == null + ? "null" + : _code.Expression(setCollection, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(setCollectionForMaterialization == null + ? "null" + : _code.Expression(setCollectionForMaterialization, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(createAndSetCollection == null + ? "null" + : _code.Expression(createAndSetCollection, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(",") + .AppendLines(createCollection == null + ? "null" + : _code.Expression(createCollection, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); } private void CreateSkipNavigation( @@ -1561,6 +1850,7 @@ private void CreateSkipNavigation( IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet namespaces, + Dictionary configurationClassNames, string className, bool nullable) { @@ -1593,6 +1883,7 @@ private void CreateSkipNavigation( methodBuilder, namespaces, variables, + configurationClassNames, nullable); mainBuilder @@ -1625,7 +1916,7 @@ private void CreateSkipNavigation( .Append(_code.Literal(navigation.IsCollection)).AppendLine(",") .Append(_code.Literal(navigation.IsOnDependent)); - PropertyBaseParameters(navigation, parameters with { TargetName = declaringEntityType }); + GeneratePropertyBaseParameters(navigation, parameters with { TargetName = declaringEntityType }); if (navigation.IsEagerLoaded) { @@ -1662,10 +1953,13 @@ private void CreateSkipNavigation( .AppendLine("}") .AppendLine(); - CreateAnnotations( - navigation, - _annotationCodeGenerator.Generate, - parameters); + var constantReplacements = new Dictionary(); + var memberAccessReplacements = new Dictionary(); + SetPropertyBaseProperties(navigation, constantReplacements, memberAccessReplacements, parameters); + + SetNavigationBaseProperties(navigation, constantReplacements, memberAccessReplacements, parameters); + + CreateAnnotations(navigation, _annotationCodeGenerator.Generate, parameters); mainBuilder .Append("return ") @@ -1702,7 +1996,7 @@ private void CreateAnnotations( IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet namespaces, - string className, + Dictionary configurationClassNames, bool nullable) { mainBuilder.AppendLine() @@ -1710,22 +2004,114 @@ private void CreateAnnotations( .AppendLine("(RuntimeEntityType runtimeEntityType)") .AppendLine("{"); + var className = configurationClassNames[entityType]; using (mainBuilder.Indent()) { const string entityTypeVariable = "runtimeEntityType"; var variables = new HashSet { entityTypeVariable }; - CreateAnnotations( - entityType, - _annotationCodeGenerator.Generate, - new CSharpRuntimeAnnotationCodeGeneratorParameters( + var parameters = new CSharpRuntimeAnnotationCodeGeneratorParameters( entityTypeVariable, className, mainBuilder, methodBuilder, namespaces, variables, - nullable)); + configurationClassNames, + nullable); + + var constantReplacements = new Dictionary() { { entityType, parameters.TargetName } }; + + var baseType = entityType.BaseType; + while (baseType != null) + { + if (!constantReplacements.ContainsKey(baseType)) + { + constantReplacements[baseType] = parameters.TargetName; + } + baseType = baseType.BaseType; + } + + Dictionary? memberAccessReplacements = null; + memberAccessReplacements = GenerateMemberReferences(entityType, constantReplacements, memberAccessReplacements, parameters); + + foreach (var navigation in entityType.GetNavigations()) + { + var variableName = _code.Identifier(navigation.Name, parameters.ScopeVariables, capitalize: false); + constantReplacements[navigation] = variableName; + + memberAccessReplacements = CreatePrivateAccessors(navigation, memberAccessReplacements, parameters, create: navigation.DeclaringType == entityType, qualify: navigation.DeclaringType != entityType); + + mainBuilder + .Append($"var {variableName} = ") + .AppendLine($"{parameters.TargetName}.FindNavigation({_code.Literal(navigation.Name)})!;"); + } + + var runtimeType = (IRuntimeEntityType)entityType; + + var originalValuesFactory = OriginalValuesFactoryFactory.Instance.CreateExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetOriginalValuesFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(originalValuesFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + var storeGeneratedValuesFactory = StoreGeneratedValuesFactoryFactory.Instance.CreateEmptyExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetStoreGeneratedValuesFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(storeGeneratedValuesFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + var temporaryValuesFactory = TemporaryValuesFactoryFactory.Instance.CreateExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetTemporaryValuesFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(temporaryValuesFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + var shadowValuesFactory = ShadowValuesFactoryFactory.Instance.CreateExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetShadowValuesFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(shadowValuesFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + var emptyShadowValuesFactory = EmptyShadowValuesFactoryFactory.Instance.CreateEmptyExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetEmptyShadowValuesFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(emptyShadowValuesFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + var relationshipSnapshotFactory = RelationshipSnapshotFactoryFactory.Instance.CreateExpression(runtimeType); + mainBuilder + .Append(parameters.TargetName).AppendLine(".SetRelationshipSnapshotFactory(") + .IncrementIndent() + .AppendLines(_code.Expression(relationshipSnapshotFactory, constantReplacements, memberAccessReplacements, parameters.Namespaces), skipFinalNewline: true) + .AppendLine(");") + .DecrementIndent(); + + AddNamespace(typeof(PropertyCounts), parameters.Namespaces); + var counts = runtimeType.Counts; + mainBuilder + .Append(parameters.TargetName).AppendLine(".Counts = new PropertyCounts(") + .IncrementIndent() + .Append("propertyCount: ").Append(_code.Literal(counts.PropertyCount)).AppendLine(",") + .Append("navigationCount: ").Append(_code.Literal(counts.NavigationCount)).AppendLine(",") + .Append("complexPropertyCount: ").Append(_code.Literal(counts.ComplexPropertyCount)).AppendLine(",") + .Append("originalValueCount: ").Append(_code.Literal(counts.OriginalValueCount)).AppendLine(",") + .Append("shadowCount: ").Append(_code.Literal(counts.ShadowCount)).AppendLine(",") + .Append("relationshipCount: ").Append(_code.Literal(counts.RelationshipCount)).AppendLine(",") + .Append("storeGeneratedCount: ").Append(_code.Literal(counts.StoreGeneratedCount)).AppendLine(");") + .DecrementIndent(); + + CreateAnnotations(entityType, _annotationCodeGenerator.Generate, parameters); mainBuilder .AppendLine() @@ -1736,6 +2122,52 @@ private void CreateAnnotations( .AppendLine("}") .AppendLine() .AppendLine("static partial void Customize(RuntimeEntityType runtimeEntityType);"); + + Dictionary? GenerateMemberReferences( + ITypeBase structuralType, + Dictionary constantReplacements, + Dictionary? memberAccessReplacements, + CSharpRuntimeAnnotationCodeGeneratorParameters parameters, + bool nested = false) + { + var mainBuilder = parameters.MainBuilder; + foreach (var property in structuralType.GetProperties()) + { + var variableName = _code.Identifier(property.Name, parameters.ScopeVariables, capitalize: false); + constantReplacements[property] = variableName; + + memberAccessReplacements = CreatePrivateAccessors( + property, memberAccessReplacements, parameters, create: false, qualify: nested || property.DeclaringType != structuralType); + + mainBuilder + .Append($"var {variableName} = ") + .AppendLine($"{constantReplacements[property.DeclaringType]}.FindProperty({_code.Literal(property.Name)})!;"); + } + + foreach (var complexProperty in structuralType.GetComplexProperties()) + { + var variableName = _code.Identifier(complexProperty.Name, parameters.ScopeVariables, capitalize: false); + constantReplacements[complexProperty] = variableName; + + memberAccessReplacements = CreatePrivateAccessors( + complexProperty, memberAccessReplacements, parameters, create: false, qualify: nested || complexProperty.DeclaringType != structuralType); + + mainBuilder + .Append($"var {variableName} = ") + .AppendLine($"{constantReplacements[complexProperty.DeclaringType]}.FindComplexProperty({_code.Literal(complexProperty.Name)})!;"); + + var typeVariableName = _code.Identifier(complexProperty.ComplexType.ShortName(), parameters.ScopeVariables, capitalize: false); + constantReplacements[complexProperty.ComplexType] = typeVariableName; + + mainBuilder + .Append($"var {typeVariableName} = ") + .AppendLine($"{variableName}.ComplexType;"); + + GenerateMemberReferences(complexProperty.ComplexType, constantReplacements, memberAccessReplacements, parameters, nested: true); + } + + return memberAccessReplacements; + } } private static void CreateAnnotations( @@ -1752,7 +2184,8 @@ private static void CreateAnnotations( annotatable, parameters with { - Annotations = annotatable.GetRuntimeAnnotations().ToDictionary(a => a.Name, a => a.Value), IsRuntime = true + Annotations = annotatable.GetRuntimeAnnotations().ToDictionary(a => a.Name, a => a.Value), + IsRuntime = true }); } diff --git a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs index b013b53e209..bfd2c130352 100644 --- a/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs +++ b/src/EFCore.Relational/Design/Internal/RelationalCSharpRuntimeAnnotationCodeGenerator.cs @@ -55,8 +55,7 @@ public override void Generate(IModel model, CSharpRuntimeAnnotationCodeGenerator var methods = methodBuilder.ToString(); if (!string.IsNullOrEmpty(methods)) { - parameters.MethodBuilder.AppendLine() - .AppendLines(methods); + parameters.MethodBuilder.AppendLines(methods); } } } diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs index 2bbc36a629a..01dbeb99eb6 100644 --- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs @@ -2034,10 +2034,6 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp private sealed class ValueBufferTryReadValueMethodsReplacer : ExpressionVisitor { - private static readonly MethodInfo PopulateListMethod - = typeof(ValueBufferTryReadValueMethodsReplacer).GetMethod( - nameof(PopulateList), BindingFlags.NonPublic | BindingFlags.Static)!; - private readonly Expression _instance; private readonly Dictionary _propertyAssignmentMap; @@ -2057,7 +2053,14 @@ protected override Expression VisitBinary(BinaryExpression node) if (property!.IsPrimitiveCollection && !property.ClrType.IsArray) { +#pragma warning disable EF1001 // Internal EF Core API usage. + var genericMethod = EntityMaterializerSource.PopulateListMethod.MakeGenericMethod( + property.ClrType.TryGetElementType(typeof(IEnumerable<>))!); +#pragma warning restore EF1001 // Internal EF Core API usage. var currentVariable = Variable(parameter!.Type); + var convertedVariable = genericMethod.GetParameters()[1].ParameterType.IsAssignableFrom(currentVariable.Type) + ? (Expression)currentVariable + : Convert(currentVariable, genericMethod.GetParameters()[1].ParameterType); return Block( new[] { currentVariable }, MakeMemberAccess(_instance, property.GetMemberInfo(forMaterialization: true, forSet: false)) @@ -2070,9 +2073,9 @@ protected override Expression VisitBinary(BinaryExpression node) ? leftMemberExpression.Assign(parameter) : MakeBinary(node.NodeType, node.Left, parameter), Call( - PopulateListMethod.MakeGenericMethod(property.ClrType.TryGetElementType(typeof(IEnumerable<>))!), + genericMethod, parameter, - currentVariable) + convertedVariable) )); } @@ -2111,17 +2114,6 @@ private bool IsPropertyAssignment( parameter = null; return false; } - - private static IList PopulateList(IList buffer, IList target) - { - target.Clear(); - foreach (var value in buffer) - { - target.Add(value); - } - - return target; - } } } diff --git a/src/EFCore/ChangeTracking/Internal/CompositeValueFactory.cs b/src/EFCore/ChangeTracking/Internal/CompositeValueFactory.cs index 111c6e46e6a..aef1710abec 100644 --- a/src/EFCore/ChangeTracking/Internal/CompositeValueFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/CompositeValueFactory.cs @@ -155,19 +155,15 @@ public virtual object CreatePrincipalEquatableKey(IUpdateEntry entry, bool fromO /// doing so can result in application failures when updating to a new Entity Framework Core release. /// protected static IEqualityComparer> CreateEqualityComparer(IReadOnlyList properties) - => new CompositeCustomComparer(properties.Select(p => p.GetKeyValueComparer()).ToList()); + => new CompositeCustomComparer(properties.Select(p => p.GetKeyValueComparer()).ToArray()); private sealed class CompositeCustomComparer : IEqualityComparer> { - private readonly int _valueCount; - private readonly Func[] _equals; - private readonly Func[] _hashCodes; + private readonly ValueComparer[] _comparers; - public CompositeCustomComparer(IList comparers) + public CompositeCustomComparer(ValueComparer[] comparers) { - _valueCount = comparers.Count; - _equals = comparers.Select(c => (Func)c.Equals).ToArray(); - _hashCodes = comparers.Select(c => (Func)c.GetHashCode).ToArray(); + _comparers = comparers; } public bool Equals(IReadOnlyList? x, IReadOnlyList? y) @@ -187,15 +183,15 @@ public bool Equals(IReadOnlyList? x, IReadOnlyList? y) return false; } - if (x.Count != _valueCount - || y.Count != _valueCount) + if (x.Count != _comparers.Length + || y.Count != _comparers.Length) { return false; } - for (var i = 0; i < _valueCount; i++) + for (var i = 0; i < _comparers.Length; i++) { - if (!_equals[i](x[i], y[i])) + if (!_comparers[i].Equals(x[i], y[i])) { return false; } @@ -212,7 +208,7 @@ public int GetHashCode(IReadOnlyList obj) // ReSharper disable once LoopCanBeConvertedToQuery for (var i = 0; i < obj.Count; i++) { - hashCode.Add(_hashCodes[i](obj[i])); + hashCode.Add(_comparers[i].GetHashCode(obj[i])); } return hashCode.ToHashCode(); diff --git a/src/EFCore/ChangeTracking/Internal/CurrentProviderValueComparer`.cs b/src/EFCore/ChangeTracking/Internal/CurrentProviderValueComparer`.cs index c7761eb8538..3a0e921ac46 100644 --- a/src/EFCore/ChangeTracking/Internal/CurrentProviderValueComparer`.cs +++ b/src/EFCore/ChangeTracking/Internal/CurrentProviderValueComparer`.cs @@ -21,12 +21,10 @@ public class CurrentProviderValueComparer : IComparer - public CurrentProviderValueComparer( - IPropertyBase property, - ValueConverter converter) + public CurrentProviderValueComparer(IProperty property) { _property = property; - _converter = converter.ConvertToProviderExpression.Compile(); + _converter = ((ValueConverter)property.GetTypeMapping().Converter!).ConvertToProviderTyped; _underlyingComparer = Comparer.Default; } diff --git a/src/EFCore/ChangeTracking/Internal/CurrentValueComparerFactory.cs b/src/EFCore/ChangeTracking/Internal/CurrentValueComparerFactory.cs index ab29fa3d622..f6c8760e9a5 100644 --- a/src/EFCore/ChangeTracking/Internal/CurrentValueComparerFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/CurrentValueComparerFactory.cs @@ -13,6 +13,18 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; /// public class CurrentValueComparerFactory { + private CurrentValueComparerFactory() + { + } + + /// + /// 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. + /// + public static readonly CurrentValueComparerFactory Instance = new(); + /// /// 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 @@ -20,24 +32,31 @@ public class CurrentValueComparerFactory /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual IComparer Create(IProperty property) + => (IComparer)Activator.CreateInstance(GetComparerType(property), property)!; + + /// + /// 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. + /// + public virtual Type GetComparerType(IProperty property) { var modelType = property.ClrType; var nonNullableModelType = modelType.UnwrapNullableType(); if (IsGenericComparable(modelType, nonNullableModelType)) { - return (IComparer)Activator.CreateInstance( - typeof(EntryCurrentValueComparer<>).MakeGenericType(modelType), - property)!; + return typeof(EntryCurrentValueComparer<>).MakeGenericType(modelType); } if (typeof(IStructuralComparable).IsAssignableFrom(nonNullableModelType)) { - return new StructuralEntryCurrentValueComparer(property); + return typeof(StructuralEntryCurrentValueComparer); } if (typeof(IComparable).IsAssignableFrom(nonNullableModelType)) { - return new EntryCurrentValueComparer(property); + return typeof(EntryCurrentValueComparer); } var converter = property.GetTypeMapping().Converter; @@ -51,24 +70,24 @@ public virtual IComparer Create(IProperty property) var modelBaseType = elementType != null ? typeof(IEnumerable<>).MakeGenericType(elementType.ClrType) : modelType; - var comparerType = modelType.IsClass + var comparerType = !modelType.IsValueType ? typeof(NullableClassCurrentProviderValueComparer<,>).MakeGenericType(modelBaseType, providerType) : modelType == converter.ModelClrType ? typeof(CurrentProviderValueComparer<,>).MakeGenericType(modelBaseType, providerType) : typeof(NullableStructCurrentProviderValueComparer<,>).MakeGenericType( nonNullableModelType, providerType); - return (IComparer)Activator.CreateInstance(comparerType, property, converter)!; + return comparerType; } if (typeof(IStructuralComparable).IsAssignableFrom(nonNullableProviderType)) { - return new StructuralEntryCurrentProviderValueComparer(property, converter); + return typeof(StructuralEntryCurrentProviderValueComparer); } if (typeof(IComparable).IsAssignableFrom(nonNullableProviderType)) { - return new EntryCurrentProviderValueComparer(property, converter); + return typeof(EntryCurrentProviderValueComparer); } throw new InvalidOperationException( diff --git a/src/EFCore/ChangeTracking/Internal/EmptyShadowValuesFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/EmptyShadowValuesFactoryFactory.cs index 1771645c961..06497d8b090 100644 --- a/src/EFCore/ChangeTracking/Internal/EmptyShadowValuesFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/EmptyShadowValuesFactoryFactory.cs @@ -52,6 +52,15 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) protected override ValueComparer? GetValueComparer(IProperty property) => null; + /// + /// 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. + /// + protected override MethodInfo? GetValueComparerMethod() + => null; + /// /// 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 diff --git a/src/EFCore/ChangeTracking/Internal/EntryCurrentProviderValueComparer.cs b/src/EFCore/ChangeTracking/Internal/EntryCurrentProviderValueComparer.cs index 2d095cb7cae..8459ef53f96 100644 --- a/src/EFCore/ChangeTracking/Internal/EntryCurrentProviderValueComparer.cs +++ b/src/EFCore/ChangeTracking/Internal/EntryCurrentProviderValueComparer.cs @@ -19,12 +19,10 @@ public class EntryCurrentProviderValueComparer : EntryCurrentValueComparer /// 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. /// - public EntryCurrentProviderValueComparer( - IProperty property, - ValueConverter converter) + public EntryCurrentProviderValueComparer(IProperty property) : base(property) { - _converter = converter; + _converter = property.GetTypeMapping().Converter!; } /// diff --git a/src/EFCore/ChangeTracking/Internal/IdentityMapFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/IdentityMapFactoryFactory.cs index 7e103190993..df18e8b9bb1 100644 --- a/src/EFCore/ChangeTracking/Internal/IdentityMapFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/IdentityMapFactoryFactory.cs @@ -20,11 +20,13 @@ public class IdentityMapFactoryFactory /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual Func Create(IKey key) - => (Func)typeof(IdentityMapFactoryFactory) - .GetMethod(nameof(CreateFactory), BindingFlags.NonPublic | BindingFlags.Static)! + => (Func)GenericCreateFactory .MakeGenericMethod(key.GetKeyType()) .Invoke(null, [key])!; + private static readonly MethodInfo GenericCreateFactory + = typeof(IdentityMapFactoryFactory).GetMethod(nameof(CreateFactory), BindingFlags.Static | BindingFlags.NonPublic)!; + [UsedImplicitly] private static Func CreateFactory(IKey key) where TKey : notnull diff --git a/src/EFCore/ChangeTracking/Internal/NullableClassCurrentProviderValueComparer.cs b/src/EFCore/ChangeTracking/Internal/NullableClassCurrentProviderValueComparer.cs index 39f4821733a..d69b9108e06 100644 --- a/src/EFCore/ChangeTracking/Internal/NullableClassCurrentProviderValueComparer.cs +++ b/src/EFCore/ChangeTracking/Internal/NullableClassCurrentProviderValueComparer.cs @@ -12,7 +12,7 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; public class NullableClassCurrentProviderValueComparer : IComparer where TModel : class { - private readonly IPropertyBase _property; + private readonly IProperty _property; private readonly IComparer _underlyingComparer; private readonly Func _converter; @@ -22,12 +22,10 @@ public class NullableClassCurrentProviderValueComparer : ICom /// 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. /// - public NullableClassCurrentProviderValueComparer( - IPropertyBase property, - ValueConverter converter) + public NullableClassCurrentProviderValueComparer(IProperty property) { _property = property; - _converter = converter.ConvertToProviderExpression.Compile(); + _converter = ((ValueConverter)property.GetTypeMapping().Converter!).ConvertToProviderTyped; _underlyingComparer = Comparer.Default; } diff --git a/src/EFCore/ChangeTracking/Internal/NullableCurrentProviderValueComparer.cs b/src/EFCore/ChangeTracking/Internal/NullableCurrentProviderValueComparer.cs index 4ee9fbf11a2..765f6766a59 100644 --- a/src/EFCore/ChangeTracking/Internal/NullableCurrentProviderValueComparer.cs +++ b/src/EFCore/ChangeTracking/Internal/NullableCurrentProviderValueComparer.cs @@ -12,7 +12,7 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; public class NullableStructCurrentProviderValueComparer : IComparer where TModel : struct { - private readonly IPropertyBase _property; + private readonly IProperty _property; private readonly IComparer _underlyingComparer; private readonly Func _converter; @@ -22,12 +22,10 @@ public class NullableStructCurrentProviderValueComparer : ICo /// 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. /// - public NullableStructCurrentProviderValueComparer( - IPropertyBase property, - ValueConverter converter) + public NullableStructCurrentProviderValueComparer(IProperty property) { _property = property; - _converter = converter.ConvertToProviderExpression.Compile(); + _converter = ((ValueConverter)property.GetTypeMapping().Converter!).ConvertToProviderTyped; _underlyingComparer = Comparer.Default; } diff --git a/src/EFCore/ChangeTracking/Internal/OriginalValuesFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/OriginalValuesFactoryFactory.cs index 5f7c67314f2..23bdf30c55f 100644 --- a/src/EFCore/ChangeTracking/Internal/OriginalValuesFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/OriginalValuesFactoryFactory.cs @@ -13,6 +13,9 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; /// public class OriginalValuesFactoryFactory : SnapshotFactoryFactory { + private static readonly MethodInfo _getValueComparerMethod + = typeof(IProperty).GetMethod(nameof(IProperty.GetValueComparer))!; + private OriginalValuesFactoryFactory() { } @@ -51,4 +54,13 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) /// protected override ValueComparer? GetValueComparer(IProperty property) => property.GetValueComparer(); + + /// + /// 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. + /// + protected override MethodInfo? GetValueComparerMethod() + => _getValueComparerMethod; } diff --git a/src/EFCore/ChangeTracking/Internal/RelationshipSnapshotFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/RelationshipSnapshotFactoryFactory.cs index 4c7b7b5d8b1..2557ec81cce 100644 --- a/src/EFCore/ChangeTracking/Internal/RelationshipSnapshotFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/RelationshipSnapshotFactoryFactory.cs @@ -13,6 +13,9 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; /// public class RelationshipSnapshotFactoryFactory : SnapshotFactoryFactory { + private static readonly MethodInfo _getValueComparerMethod + = typeof(IProperty).GetMethod(nameof(IProperty.GetKeyValueComparer))!; + private RelationshipSnapshotFactoryFactory() { } @@ -51,4 +54,13 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) /// protected override ValueComparer? GetValueComparer(IProperty property) => property.GetKeyValueComparer(); + + /// + /// 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. + /// + protected override MethodInfo? GetValueComparerMethod() + => _getValueComparerMethod; } diff --git a/src/EFCore/ChangeTracking/Internal/ShadowValuesFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/ShadowValuesFactoryFactory.cs index f15f073578c..9b845c7edbb 100644 --- a/src/EFCore/ChangeTracking/Internal/ShadowValuesFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/ShadowValuesFactoryFactory.cs @@ -52,6 +52,15 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) protected override ValueComparer? GetValueComparer(IProperty property) => null; + /// + /// 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. + /// + protected override MethodInfo? GetValueComparerMethod() + => null; + /// /// 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 @@ -61,9 +70,6 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) protected override bool UseEntityVariable => false; - internal static readonly MethodInfo ContainsKeyMethod = - typeof(IDictionary).GetMethod(nameof(IDictionary.ContainsKey), [typeof(string)])!; - private static readonly PropertyInfo DictionaryIndexer = typeof(IDictionary).GetRuntimeProperties().Single(p => p.GetIndexParameters().Length > 0); @@ -93,7 +99,7 @@ protected override Expression CreateReadShadowValueExpression( property.ClrType); } - return Expression.Condition(Expression.Call(parameter, ContainsKeyMethod, Expression.Constant(property.Name)), + return Expression.Condition(Expression.Call(parameter, PropertyAccessorsFactory.ContainsKeyMethod, Expression.Constant(property.Name)), Expression.Convert(Expression.MakeIndex( parameter, DictionaryIndexer, diff --git a/src/EFCore/ChangeTracking/Internal/SidecarValuesFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/SidecarValuesFactoryFactory.cs index 728fc48d83e..6cce1abafd5 100644 --- a/src/EFCore/ChangeTracking/Internal/SidecarValuesFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/SidecarValuesFactoryFactory.cs @@ -13,6 +13,9 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal; /// public class SidecarValuesFactoryFactory : SnapshotFactoryFactory { + private static readonly MethodInfo _getValueComparerMethod + = typeof(IProperty).GetMethod(nameof(IProperty.GetValueComparer))!; + /// /// 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 @@ -57,4 +60,13 @@ protected override int GetPropertyCount(IRuntimeEntityType entityType) /// protected override ValueComparer? GetValueComparer(IProperty property) => property.GetValueComparer(); + + /// + /// 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. + /// + protected override MethodInfo? GetValueComparerMethod() + => _getValueComparerMethod; } diff --git a/src/EFCore/ChangeTracking/Internal/SimplePrincipalKeyValueFactory.cs b/src/EFCore/ChangeTracking/Internal/SimplePrincipalKeyValueFactory.cs index 71778671a49..43b782066a0 100644 --- a/src/EFCore/ChangeTracking/Internal/SimplePrincipalKeyValueFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/SimplePrincipalKeyValueFactory.cs @@ -30,7 +30,7 @@ public SimplePrincipalKeyValueFactory(IKey key) _property = key.Properties.Single(); _propertyAccessors = _property.GetPropertyAccessors(); - EqualityComparer = new NoNullsCustomEqualityComparer(_property.GetKeyValueComparer()); + EqualityComparer = new NoNullsCustomEqualityComparer((ValueComparer)_property.GetKeyValueComparer()); } /// @@ -121,19 +121,17 @@ public virtual object CreateEquatableKey(IUpdateEntry entry, bool fromOriginalVa private sealed class NoNullsCustomEqualityComparer : IEqualityComparer { - private readonly Func _equals; - private readonly Func _hashCode; + private readonly ValueComparer _comparer; - public NoNullsCustomEqualityComparer(ValueComparer comparer) + public NoNullsCustomEqualityComparer(ValueComparer comparer) { - _equals = (Func)comparer.EqualsExpression.Compile(); - _hashCode = (Func)comparer.HashCodeExpression.Compile(); + _comparer = comparer; } public bool Equals(TKey? x, TKey? y) - => _equals(x, y); + => _comparer.Equals(x, y); public int GetHashCode([DisallowNull] TKey obj) - => _hashCode(obj); + => _comparer.GetHashCode(obj); } } diff --git a/src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs b/src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs index 127deb27422..d7cae14cec3 100644 --- a/src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs +++ b/src/EFCore/ChangeTracking/Internal/SnapshotFactoryFactory.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using JetBrains.Annotations; +using System.Reflection.Metadata; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -141,7 +141,7 @@ protected virtual Expression CreateSnapshotExpression( } var memberInfo = propertyBase.GetMemberInfo(forMaterialization: false, forSet: false); - var memberAccess = PropertyBase.CreateMemberAccess(propertyBase, entityVariable!, memberInfo, fromContainingType: false); + var memberAccess = PropertyAccessorsFactory.CreateMemberAccess(propertyBase, entityVariable!, memberInfo, fromContainingType: false); if (memberAccess.Type != propertyBase.ClrType) { @@ -200,10 +200,16 @@ private Expression CreateSnapshotValueExpression(Expression expression, IPropert expression = Expression.Convert(expression, comparer.Type); } - var snapshotExpression = ReplacingExpressionVisitor.Replace( - comparer.SnapshotExpression.Parameters.Single(), - expression, - comparer.SnapshotExpression.Body); + var comparerExpression = Expression.Convert( + Expression.Call( + Expression.Constant(property), + GetValueComparerMethod()!), + typeof(ValueComparer<>).MakeGenericType(comparer.Type)); + + Expression snapshotExpression = Expression.Call( + comparerExpression, + ValueComparer.GetGenericSnapshotMethod(comparer.Type), + expression); if (snapshotExpression.Type != propertyBase.ClrType) { @@ -228,6 +234,14 @@ private Expression CreateSnapshotValueExpression(Expression expression, IPropert /// protected abstract ValueComparer? GetValueComparer(IProperty property); + /// + /// 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. + /// + protected abstract MethodInfo? GetValueComparerMethod(); + /// /// 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 @@ -284,8 +298,13 @@ protected virtual bool UseEntityVariable private static readonly MethodInfo SnapshotCollectionMethod = typeof(SnapshotFactoryFactory).GetTypeInfo().GetDeclaredMethod(nameof(SnapshotCollection))!; - [UsedImplicitly] - private static HashSet? SnapshotCollection(IEnumerable? collection) + /// + /// 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. + /// + public static HashSet? SnapshotCollection(IEnumerable? collection) => collection == null ? null : new HashSet(collection, ReferenceEqualityComparer.Instance); diff --git a/src/EFCore/ChangeTracking/Internal/StructuralEntryCurrentProviderValueComparer.cs b/src/EFCore/ChangeTracking/Internal/StructuralEntryCurrentProviderValueComparer.cs index 9a26cd70acf..a1448a4b41c 100644 --- a/src/EFCore/ChangeTracking/Internal/StructuralEntryCurrentProviderValueComparer.cs +++ b/src/EFCore/ChangeTracking/Internal/StructuralEntryCurrentProviderValueComparer.cs @@ -19,12 +19,10 @@ public class StructuralEntryCurrentProviderValueComparer : StructuralEntryCurren /// 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. /// - public StructuralEntryCurrentProviderValueComparer( - IProperty property, - ValueConverter converter) + public StructuralEntryCurrentProviderValueComparer(IProperty property) : base(property) { - _converter = converter; + _converter = property.GetTypeMapping().Converter!; } /// diff --git a/src/EFCore/ChangeTracking/ValueComparer.cs b/src/EFCore/ChangeTracking/ValueComparer.cs index 4226f3ecad1..2b5e80fd71f 100644 --- a/src/EFCore/ChangeTracking/ValueComparer.cs +++ b/src/EFCore/ChangeTracking/ValueComparer.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; +using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; namespace Microsoft.EntityFrameworkCore.ChangeTracking; @@ -40,6 +41,24 @@ internal static readonly MethodInfo EqualityComparerEqualsMethod internal static readonly MethodInfo ObjectGetHashCodeMethod = typeof(object).GetRuntimeMethod(nameof(object.GetHashCode), Type.EmptyTypes)!; + private static readonly ConcurrentDictionary _genericSnapshotMethodMap = new(); + + /// + /// 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. + /// + [EntityFrameworkInternal] + public static MethodInfo GetGenericSnapshotMethod(Type type) + => _genericSnapshotMethodMap.GetOrAdd(type, t => + typeof(ValueComparer<>).MakeGenericType(t).GetGenericMethod( + nameof(ValueComparer.Snapshot), + genericParameterCount: 0, + BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, + (a, b) => new[] { a[0] }, + @override: false)!); + /// /// 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 diff --git a/src/EFCore/ChangeTracking/ValueComparer`.cs b/src/EFCore/ChangeTracking/ValueComparer`.cs index 5b7afaa4a82..84f7632f435 100644 --- a/src/EFCore/ChangeTracking/ValueComparer`.cs +++ b/src/EFCore/ChangeTracking/ValueComparer`.cs @@ -136,7 +136,7 @@ public ValueComparer( if (typedEquals != null) { return Expression.Lambda>( - type.IsClass + type.IsNullableType() ? Expression.OrElse( Expression.AndAlso( Expression.Equal(param1, Expression.Constant(null, type)), diff --git a/src/EFCore/Design/ICSharpHelper.cs b/src/EFCore/Design/ICSharpHelper.cs index e594a3ec20b..a42aa25949f 100644 --- a/src/EFCore/Design/ICSharpHelper.cs +++ b/src/EFCore/Design/ICSharpHelper.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Numerics; +using Microsoft.EntityFrameworkCore.Design.Internal; namespace Microsoft.EntityFrameworkCore.Design; @@ -319,7 +320,7 @@ string Literal(Dictionary values, bool vertical = fa string Fragment(AttributeCodeFragment fragment); /// - /// Generates a comma-sepearated argument list of values. + /// Generates a comma-separated argument list of values. /// /// The values. /// The argument list. @@ -336,6 +337,8 @@ string Literal(Dictionary values, bool vertical = fa /// Translates a node representing a statement into source code that would produce it. /// /// The node to be translated. + /// Collection of translations for statically known instances. + /// Collection of translations for non-public member accesses. /// Any namespaces required by the translated code will be added to this set. /// Source code that would produce . /// @@ -345,12 +348,17 @@ string Literal(Dictionary values, bool vertical = fa /// doing so can result in application failures when updating to a new Entity Framework Core release. /// [EntityFrameworkInternal] - string Statement(Expression node, ISet collectedNamespaces); + string Statement(Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces); /// /// Translates a node representing an expression into source code that would produce it. /// /// The node to be translated. + /// Collection of translations for statically known instances. + /// Collection of translations for non-public member accesses. /// Any namespaces required by the translated code will be added to this set. /// Source code that would produce . /// @@ -360,5 +368,8 @@ string Literal(Dictionary values, bool vertical = fa /// doing so can result in application failures when updating to a new Entity Framework Core release. /// [EntityFrameworkInternal] - string Expression(Expression node, ISet collectedNamespaces); + string Expression(Expression node, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements, + ISet collectedNamespaces); } diff --git a/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGenerator.cs b/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGenerator.cs index 75700524a3b..666a8cfe1bb 100644 --- a/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGenerator.cs +++ b/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGenerator.cs @@ -371,9 +371,11 @@ public static void Create( .Append(codeHelper.Reference(converter.ProviderClrType)) .AppendLine(">(") .IncrementIndent() - .Append(codeHelper.Expression(converter.ConvertToProviderExpression, parameters.Namespaces)) + .AppendLines(codeHelper.Expression(converter.ConvertToProviderExpression, null, null, parameters.Namespaces), + skipFinalNewline: true) .AppendLine(",") - .Append(codeHelper.Expression(converter.ConvertFromProviderExpression, parameters.Namespaces)); + .AppendLines(codeHelper.Expression(converter.ConvertFromProviderExpression, null, null, parameters.Namespaces), + skipFinalNewline: true); if (converter.ConvertsNulls) { @@ -428,11 +430,14 @@ public static void Create( .Append(codeHelper.Reference(comparer.Type)) .AppendLine(">(") .IncrementIndent() - .AppendLines(codeHelper.Expression(comparer.EqualsExpression, parameters.Namespaces), skipFinalNewline: true) + .AppendLines(codeHelper.Expression(comparer.EqualsExpression, null, null, parameters.Namespaces), + skipFinalNewline: true) .AppendLine(",") - .AppendLines(codeHelper.Expression(comparer.HashCodeExpression, parameters.Namespaces), skipFinalNewline: true) + .AppendLines(codeHelper.Expression(comparer.HashCodeExpression, null, null, parameters.Namespaces), + skipFinalNewline: true) .AppendLine(",") - .AppendLines(codeHelper.Expression(comparer.SnapshotExpression, parameters.Namespaces), skipFinalNewline: true) + .AppendLines(codeHelper.Expression(comparer.SnapshotExpression, null, null, parameters.Namespaces), + skipFinalNewline: true) .Append(")") .DecrementIndent(); } diff --git a/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGeneratorParameters.cs b/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGeneratorParameters.cs index 3cbce4374ec..d16cf567d77 100644 --- a/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGeneratorParameters.cs +++ b/src/EFCore/Design/Internal/CSharpRuntimeAnnotationCodeGeneratorParameters.cs @@ -30,6 +30,7 @@ public CSharpRuntimeAnnotationCodeGeneratorParameters( IndentedStringBuilder methodBuilder, ISet namespaces, ISet scopeVariables, + Dictionary configurationClassNames, bool nullable) { TargetName = targetName; @@ -38,6 +39,7 @@ public CSharpRuntimeAnnotationCodeGeneratorParameters( MethodBuilder = methodBuilder; Namespaces = namespaces; ScopeVariables = scopeVariables; + ConfigurationClassNames = configurationClassNames; UseNullableReferenceTypes = nullable; } @@ -76,6 +78,11 @@ public CSharpRuntimeAnnotationCodeGeneratorParameters( /// public ISet ScopeVariables { get; init; } + /// + /// The configuration class names corresponding to the structural types. + /// + public IReadOnlyDictionary ConfigurationClassNames { get; init; } + /// /// Indicates whether the given annotations are runtime annotations. /// diff --git a/src/EFCore/Metadata/Internal/NullableEnumClrPropertySetter.cs b/src/EFCore/Design/Internal/MemberAccess.cs similarity index 69% rename from src/EFCore/Metadata/Internal/NullableEnumClrPropertySetter.cs rename to src/EFCore/Design/Internal/MemberAccess.cs index a8251dbff60..7bf8836a34c 100644 --- a/src/EFCore/Metadata/Internal/NullableEnumClrPropertySetter.cs +++ b/src/EFCore/Design/Internal/MemberAccess.cs @@ -1,7 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.EntityFrameworkCore.Metadata.Internal; +// ReSharper disable once CheckNamespace + +namespace Microsoft.EntityFrameworkCore.Design.Internal; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -9,21 +11,15 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// 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. /// -public class NullableEnumClrPropertySetter : IClrPropertySetter - where TEntity : class +public readonly record struct MemberAccess(MemberInfo member, bool assignment) { - private readonly Action _setter; - /// /// 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. /// - public NullableEnumClrPropertySetter(Action setter) - { - _setter = setter; - } + public readonly MemberInfo Member = member; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -31,13 +27,5 @@ public NullableEnumClrPropertySetter(Action setter) /// 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. /// - public virtual void SetClrValue(object instance, object? value) - { - if (value != null) - { - value = (TNonNullableEnumValue)value; - } - - _setter((TEntity)instance, (TValue)value!); - } + public readonly bool Assignment = assignment; } diff --git a/src/EFCore/Extensions/Internal/ExpressionExtensions.cs b/src/EFCore/Extensions/Internal/ExpressionExtensions.cs index 05b23dedcb5..077bf18df50 100644 --- a/src/EFCore/Extensions/Internal/ExpressionExtensions.cs +++ b/src/EFCore/Extensions/Internal/ExpressionExtensions.cs @@ -38,9 +38,9 @@ public static Expression MakeHasSentinel( Expression.Constant(null, currentValueExpression.Type)) : isNullableValueType ? Expression.Not( - Expression.Call( + Expression.MakeMemberAccess( currentValueExpression, - currentValueExpression.Type.GetMethod("get_HasValue")!)) + currentValueExpression.Type.GetProperty("HasValue")!)) : Expression.Constant(false); } @@ -62,9 +62,9 @@ public static Expression MakeHasSentinel( Expression.ReferenceEqual( currentValueExpression, Expression.Constant(null, currentValueExpression.Type))) - : Expression.Call( + : Expression.MakeMemberAccess( currentValueExpression, - currentValueExpression.Type.GetMethod("get_HasValue")!), + currentValueExpression.Type.GetProperty("HasValue")!), equalsExpression); } @@ -238,20 +238,20 @@ static Expression GenerateEqualExpression( EF.MakePropertyMethod(typeof(object)), entityParameterExpression, Expression.Constant(property.Name, typeof(string))), - Expression.Call( + Expression.MakeIndex( keyValuesConstantExpression, - ValueBuffer.GetValueMethod, - Expression.Constant(i))) + ValueBuffer.Indexer, + new[] { Expression.Constant(i) })) : Expression.Equal( Expression.Call( EF.MakePropertyMethod(property.ClrType), entityParameterExpression, Expression.Constant(property.Name, typeof(string))), Expression.Convert( - Expression.Call( + Expression.MakeIndex( keyValuesConstantExpression, - ValueBuffer.GetValueMethod, - Expression.Constant(i)), + ValueBuffer.Indexer, + new[] { Expression.Constant(i) }), property.ClrType)); } } diff --git a/src/EFCore/Infrastructure/Internal/DbSetFinder.cs b/src/EFCore/Infrastructure/Internal/DbSetFinder.cs index 3200c0e3366..bab939cc544 100644 --- a/src/EFCore/Infrastructure/Internal/DbSetFinder.cs +++ b/src/EFCore/Infrastructure/Internal/DbSetFinder.cs @@ -27,7 +27,7 @@ public virtual IReadOnlyList FindSets(Type contextType) private static DbSetProperty[] FindSetsNonCached(Type contextType) { - var factory = new ClrPropertySetterFactory(); + var factory = ClrPropertySetterFactory.Instance; return contextType.GetRuntimeProperties() .Where( diff --git a/src/EFCore/Internal/ManyToManyLoaderFactory.cs b/src/EFCore/Internal/ManyToManyLoaderFactory.cs index cb8db2ec394..123174f8b38 100644 --- a/src/EFCore/Internal/ManyToManyLoaderFactory.cs +++ b/src/EFCore/Internal/ManyToManyLoaderFactory.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore.Metadata.Internal; namespace Microsoft.EntityFrameworkCore.Internal; @@ -16,6 +17,18 @@ public class ManyToManyLoaderFactory private static readonly MethodInfo GenericCreate = typeof(ManyToManyLoaderFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateManyToMany))!; + private ManyToManyLoaderFactory() + { + } + + /// + /// 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. + /// + public static readonly ManyToManyLoaderFactory Instance = new(); + /// /// 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 diff --git a/src/EFCore/Metadata/IPropertyBase.cs b/src/EFCore/Metadata/IPropertyBase.cs index a180fa60267..f16ee93717d 100644 --- a/src/EFCore/Metadata/IPropertyBase.cs +++ b/src/EFCore/Metadata/IPropertyBase.cs @@ -49,14 +49,9 @@ public interface IPropertyBase : IReadOnlyPropertyBase, IAnnotatable /// /// The to use. MemberInfo GetMemberInfo(bool forMaterialization, bool forSet) - { - if (this.TryGetMemberInfo(forMaterialization, forSet, out var memberInfo, out var errorMessage)) - { - return memberInfo!; - } - - throw new InvalidOperationException(errorMessage); - } + => this.TryGetMemberInfo(forMaterialization, forSet, out var memberInfo, out var errorMessage) + ? memberInfo! + : throw new InvalidOperationException(errorMessage); /// /// Gets the property index for this property. diff --git a/src/EFCore/Metadata/Internal/ClrAccessorFactory.cs b/src/EFCore/Metadata/Internal/ClrAccessorFactory.cs index 66bf1fa92de..3fd5b512484 100644 --- a/src/EFCore/Metadata/Internal/ClrAccessorFactory.cs +++ b/src/EFCore/Metadata/Internal/ClrAccessorFactory.cs @@ -15,7 +15,7 @@ public abstract class ClrAccessorFactory where TAccessor : class { private static readonly MethodInfo GenericCreate - = typeof(ClrAccessorFactory).GetTypeInfo().GetDeclaredMethods(nameof(CreateGeneric)).Single(); + = typeof(ClrAccessorFactory).GetMethod(nameof(CreateGeneric), BindingFlags.Instance | BindingFlags.NonPublic)!; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -32,7 +32,7 @@ private static readonly MethodInfo GenericCreate /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual TAccessor Create(MemberInfo memberInfo) - => Create(memberInfo, null); + => CreateBase(memberInfo); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -40,23 +40,16 @@ public virtual TAccessor Create(MemberInfo memberInfo) /// 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. /// - protected virtual TAccessor Create(MemberInfo memberInfo, IPropertyBase? propertyBase) + protected virtual TAccessor CreateBase(MemberInfo memberInfo) { - var boundMethod = propertyBase != null - ? GenericCreate.MakeGenericMethod( - propertyBase.DeclaringType.ContainingEntityType.ClrType, - propertyBase.DeclaringType.ClrType, - propertyBase.ClrType, - propertyBase.ClrType.UnwrapNullableType()) - : GenericCreate.MakeGenericMethod( - memberInfo.DeclaringType!, - memberInfo.DeclaringType!, - memberInfo.GetMemberType(), - memberInfo.GetMemberType().UnwrapNullableType()); + var boundMethod = GenericCreate.MakeGenericMethod( + memberInfo.DeclaringType!, + memberInfo.DeclaringType!, + memberInfo.GetMemberType()); try { - return (TAccessor)boundMethod.Invoke(this, [memberInfo, propertyBase])!; + return (TAccessor)boundMethod.Invoke(this, new object?[] { memberInfo, null })!; } catch (TargetInvocationException e) when (e.InnerException != null) { @@ -71,8 +64,40 @@ protected virtual TAccessor Create(MemberInfo memberInfo, IPropertyBase? propert /// 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. /// - protected abstract TAccessor CreateGeneric( + protected virtual TAccessor CreateBase(IPropertyBase propertyBase) + { + var boundMethod = GenericCreate.MakeGenericMethod( + propertyBase.DeclaringType.ContainingEntityType.ClrType, + propertyBase.DeclaringType.ClrType, + propertyBase.ClrType); + + try + { + return (TAccessor)boundMethod.Invoke(this, new object?[] { GetMemberInfo(propertyBase), propertyBase })!; + } + catch (TargetInvocationException e) when (e.InnerException != null) + { + ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + throw; + } + } + + /// + /// 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. + /// + protected abstract TAccessor CreateGeneric( MemberInfo memberInfo, IPropertyBase? propertyBase) where TEntity : class; + + /// + /// 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. + /// + protected abstract MemberInfo GetMemberInfo(IPropertyBase propertyBase); } diff --git a/src/EFCore/Metadata/Internal/ClrCollectionAccessorFactory.cs b/src/EFCore/Metadata/Internal/ClrCollectionAccessorFactory.cs index ef4fc85b7b6..73dc02c80b0 100644 --- a/src/EFCore/Metadata/Internal/ClrCollectionAccessorFactory.cs +++ b/src/EFCore/Metadata/Internal/ClrCollectionAccessorFactory.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.ExceptionServices; using JetBrains.Annotations; namespace Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -19,20 +20,23 @@ private static readonly MethodInfo GenericCreate private static readonly MethodInfo CreateAndSetMethod = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateAndSet))!; - private static readonly MethodInfo CreateMethod - = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateCollection))!; - private static readonly MethodInfo CreateAndSetHashSetMethod = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateAndSetHashSet))!; - private static readonly MethodInfo CreateHashSetMethod - = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateHashSet))!; - private static readonly MethodInfo CreateAndSetObservableHashSetMethod = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateAndSetObservableHashSet))!; - private static readonly MethodInfo CreateObservableHashSetMethod - = typeof(ClrCollectionAccessorFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateObservableHashSet))!; + /// + /// 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. + /// + public static readonly ClrCollectionAccessorFactory Instance = new(); + + private ClrCollectionAccessorFactory() + { + } /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -41,28 +45,30 @@ private static readonly MethodInfo CreateObservableHashSetMethod /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public virtual IClrCollectionAccessor? Create(INavigationBase navigation) - => !navigation.IsCollection ? null : Create(navigation, navigation.TargetEntityType); - - private static IClrCollectionAccessor? Create(IPropertyBase navigation, IEntityType? targetType) { + if (!navigation.IsCollection) + { + return null; + } + // ReSharper disable once SuspiciousTypeConversion.Global if (navigation is IClrCollectionAccessor accessor) { return accessor; } + var targetType = navigation.TargetEntityType; if (targetType == null) { return null; } - var memberInfo = GetMostDerivedMemberInfo(); + var memberInfo = GetMostDerivedMemberInfo(navigation); var propertyType = navigation.IsIndexerProperty() || navigation.IsShadowProperty() ? navigation.ClrType : memberInfo!.GetMemberType(); var elementType = propertyType.TryGetElementType(typeof(IEnumerable<>)); - if (elementType == null) { throw new InvalidOperationException( @@ -93,125 +99,161 @@ private static readonly MethodInfo CreateObservableHashSetMethod { throw invocationException.InnerException!; } + } + + [UsedImplicitly] + private static IClrCollectionAccessor CreateGeneric(INavigationBase navigation) + where TEntity : class + where TCollection : class, IEnumerable + where TElement : class + { + CreateExpressions( + navigation, + out var getCollection, + out var setCollection, + out var setCollectionForMaterialization, + out var createAndSetCollection, + out var createCollection); - MemberInfo? GetMostDerivedMemberInfo() + return new ClrICollectionAccessor( + navigation.Name, + navigation.IsShadowProperty(), + getCollection?.Compile(), + setCollection?.Compile(), + setCollectionForMaterialization?.Compile(), + createAndSetCollection?.Compile(), + createCollection?.Compile()); + } + + /// + /// 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. + /// + public virtual void Create( + INavigationBase navigation, + out Type entityType, + out Type propertyType, + out Type elementType, + out Expression? getCollection, + out Expression? setCollection, + out Expression? setCollectionForMaterialization, + out Expression? createAndSetCollection, + out Expression? createCollection) + { + var memberInfo = GetMostDerivedMemberInfo(navigation); + entityType = memberInfo?.DeclaringType ?? navigation.DeclaringType.ClrType; + propertyType = navigation.IsIndexerProperty() || navigation.IsShadowProperty() + ? navigation.ClrType + : memberInfo!.GetMemberType(); + + elementType = propertyType.TryGetElementType(typeof(IEnumerable<>))!; + + var boundMethod = GenericCreateExpressions.MakeGenericMethod(entityType, propertyType, elementType); + + try + { + var parameters = new object?[] { navigation, null, null, null, null, null }; + boundMethod.Invoke(this, parameters); + getCollection = (Expression)parameters[1]!; + setCollection = (Expression)parameters[2]!; + setCollectionForMaterialization = (Expression?)parameters[3]; + createAndSetCollection = (Expression)parameters[4]!; + createCollection = (Expression?)parameters[5]; + } + catch (TargetInvocationException e) when (e.InnerException != null) { - var propertyInfo = navigation.PropertyInfo; - var fieldInfo = navigation.FieldInfo; - - return (fieldInfo == null - ? propertyInfo - : propertyInfo == null - ? fieldInfo - : fieldInfo.FieldType.IsAssignableFrom(propertyInfo.PropertyType) - ? propertyInfo - : fieldInfo); + ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + throw; } } + private static readonly MethodInfo GenericCreateExpressions + = typeof(ClrCollectionAccessorFactory).GetMethod(nameof(CreateExpressions), BindingFlags.Static | BindingFlags.NonPublic)!; + [UsedImplicitly] - private static IClrCollectionAccessor CreateGeneric(INavigationBase navigation) + private static void CreateExpressions( + INavigationBase navigation, + out Expression>? getCollection, + out Expression>? setCollection, + out Expression>? setCollectionForMaterialization, + out Expression, TCollection>>? createAndSetCollection, + out Expression>? createCollection) where TEntity : class where TCollection : class, IEnumerable where TElement : class { + getCollection = null; + setCollection = null; + setCollectionForMaterialization = null; + createAndSetCollection = null; + createCollection = null; + var entityParameter = Expression.Parameter(typeof(TEntity), "entity"); var valueParameter = Expression.Parameter(typeof(TCollection), "collection"); - Func? getterDelegate = null; - Action? setterDelegate = null; - Action? setterDelegateForMaterialization = null; - Func, TCollection>? createAndSetDelegate = null; - Func? createDelegate = null; - if (!navigation.IsShadowProperty()) { var memberInfoForRead = navigation.GetMemberInfo(forMaterialization: false, forSet: false); navigation.TryGetMemberInfo(forMaterialization: false, forSet: true, out var memberInfoForWrite, out _); navigation.TryGetMemberInfo(forMaterialization: true, forSet: true, out var memberInfoForMaterialization, out _); - var memberAccessForRead = (Expression)Expression.MakeMemberAccess(entityParameter, memberInfoForRead); if (memberAccessForRead.Type != typeof(TCollection)) { memberAccessForRead = Expression.Convert(memberAccessForRead, typeof(TCollection)); } - getterDelegate = Expression.Lambda>( + getCollection = Expression.Lambda>( memberAccessForRead, - entityParameter).Compile(); + entityParameter); if (memberInfoForWrite != null) { - setterDelegate = CreateSetterDelegate(entityParameter, memberInfoForWrite, valueParameter); + setCollection = CreateSetterDelegate(entityParameter, memberInfoForWrite, valueParameter); } if (memberInfoForMaterialization != null) { - setterDelegateForMaterialization = CreateSetterDelegate(entityParameter, memberInfoForMaterialization, valueParameter); + setCollectionForMaterialization = CreateSetterDelegate(entityParameter, memberInfoForMaterialization, valueParameter); } } - var concreteType = new CollectionTypeFactory().TryFindTypeToInstantiate( + var concreteType = CollectionTypeFactory.Instance.TryFindTypeToInstantiate( typeof(TEntity), typeof(TCollection), navigation.DeclaringEntityType.Model[CoreAnnotationNames.FullChangeTrackingNotificationsRequired] != null); - if (concreteType != null) { var isHashSet = concreteType.IsGenericType && concreteType.GetGenericTypeDefinition() == typeof(HashSet<>); - if (setterDelegate != null - || setterDelegateForMaterialization != null) + if (setCollection != null + || setCollectionForMaterialization != null) { - if (isHashSet) - { - createAndSetDelegate = (Func, TCollection>)CreateAndSetHashSetMethod - .MakeGenericMethod(typeof(TEntity), typeof(TCollection), typeof(TElement)) - .CreateDelegate(typeof(Func, TCollection>)); - } - else if (IsObservableHashSet(concreteType)) - { - createAndSetDelegate = (Func, TCollection>)CreateAndSetObservableHashSetMethod + var setterParameter = Expression.Parameter(typeof(Action), "setter"); + + var createAndSetCollectionMethod = isHashSet + ? CreateAndSetHashSetMethod .MakeGenericMethod(typeof(TEntity), typeof(TCollection), typeof(TElement)) - .CreateDelegate(typeof(Func, TCollection>)); - } - else - { - createAndSetDelegate = (Func, TCollection>)CreateAndSetMethod - .MakeGenericMethod(typeof(TEntity), typeof(TCollection), concreteType) - .CreateDelegate(typeof(Func, TCollection>)); - } + : IsObservableHashSet(concreteType) + ? CreateAndSetObservableHashSetMethod + .MakeGenericMethod(typeof(TEntity), typeof(TCollection), typeof(TElement)) + : CreateAndSetMethod + .MakeGenericMethod(typeof(TEntity), typeof(TCollection), concreteType); + + createAndSetCollection = Expression.Lambda, TCollection>>( + Expression.Call(createAndSetCollectionMethod, entityParameter, setterParameter), + entityParameter, + setterParameter); } - if (isHashSet) - { - createDelegate = (Func)CreateHashSetMethod - .MakeGenericMethod(typeof(TCollection), typeof(TElement)) - .CreateDelegate(typeof(Func)); - } - else if (IsObservableHashSet(concreteType)) - { - createDelegate = (Func)CreateObservableHashSetMethod - .MakeGenericMethod(typeof(TCollection), typeof(TElement)) - .CreateDelegate(typeof(Func)); - } - else - { - createDelegate = (Func)CreateMethod - .MakeGenericMethod(typeof(TCollection), concreteType) - .CreateDelegate(typeof(Func)); - } + createCollection = isHashSet + ? (() => (TCollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)) + : IsObservableHashSet(concreteType) + ? (() => (TCollection)(ICollection)new ObservableHashSet(ReferenceEqualityComparer.Instance)) + : Expression.Lambda>(Expression.New(concreteType)); } - return new ClrICollectionAccessor( - navigation.Name, - navigation.IsShadowProperty(), - getterDelegate, - setterDelegate, - setterDelegateForMaterialization, - createAndSetDelegate, - createDelegate); - - static Action CreateSetterDelegate( + static Expression> CreateSetterDelegate( ParameterExpression parameterExpression, MemberInfo memberInfo, ParameterExpression valueParameter1) @@ -223,14 +265,33 @@ static Action CreateSetterDelegate( valueParameter1, memberInfo.GetMemberType())), parameterExpression, - valueParameter1).Compile(); + valueParameter1); + } + + private static MemberInfo? GetMostDerivedMemberInfo(INavigationBase navigation) + { + var propertyInfo = navigation.PropertyInfo; + var fieldInfo = navigation.FieldInfo; + + return fieldInfo == null + ? propertyInfo + : propertyInfo == null + ? fieldInfo + : fieldInfo.FieldType.IsAssignableFrom(propertyInfo.PropertyType) + ? propertyInfo + : fieldInfo; } private static bool IsObservableHashSet(Type type) => type.IsGenericType && type.GetGenericTypeDefinition() == typeof(ObservableHashSet<>); - [UsedImplicitly] - private static TCollection CreateAndSet( + /// + /// 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. + /// + public static TCollection CreateAndSet( TEntity entity, Action setterDelegate) where TEntity : class @@ -242,14 +303,13 @@ private static TCollection CreateAndSet() - where TCollection : class - where TConcreteCollection : TCollection, new() - => new TConcreteCollection(); - - [UsedImplicitly] - private static TCollection CreateAndSetHashSet( + /// + /// 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. + /// + public static TCollection CreateAndSetHashSet( TEntity entity, Action setterDelegate) where TEntity : class @@ -261,14 +321,13 @@ private static TCollection CreateAndSetHashSet( return collection; } - [UsedImplicitly] - private static TCollection CreateHashSet() - where TCollection : class - where TElement : class - => (TCollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance); - - [UsedImplicitly] - private static TCollection CreateAndSetObservableHashSet( + /// + /// 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. + /// + public static TCollection CreateAndSetObservableHashSet( TEntity entity, Action setterDelegate) where TEntity : class @@ -279,10 +338,4 @@ private static TCollection CreateAndSetObservableHashSet() - where TCollection : class - where TElement : class - => (TCollection)(ICollection)new ObservableHashSet(ReferenceEqualityComparer.Instance); } diff --git a/src/EFCore/Metadata/Internal/ClrPropertyGetterFactory.cs b/src/EFCore/Metadata/Internal/ClrPropertyGetterFactory.cs index e98b055ec5a..91a8bb560bf 100644 --- a/src/EFCore/Metadata/Internal/ClrPropertyGetterFactory.cs +++ b/src/EFCore/Metadata/Internal/ClrPropertyGetterFactory.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.ExceptionServices; using Microsoft.EntityFrameworkCore.Internal; namespace Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -13,6 +14,18 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// public class ClrPropertyGetterFactory : ClrAccessorFactory { + private ClrPropertyGetterFactory() + { + } + + /// + /// 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. + /// + public static readonly ClrPropertyGetterFactory Instance = new(); + /// /// 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 @@ -20,7 +33,7 @@ public class ClrPropertyGetterFactory : ClrAccessorFactory /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public override IClrPropertyGetter Create(IPropertyBase property) - => property as IClrPropertyGetter ?? Create(property.GetMemberInfo(forMaterialization: false, forSet: false), property); + => property as IClrPropertyGetter ?? CreateBase(property); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -28,9 +41,72 @@ public override IClrPropertyGetter Create(IPropertyBase property) /// 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. /// - protected override IClrPropertyGetter CreateGeneric( + protected override IClrPropertyGetter CreateGeneric( MemberInfo memberInfo, IPropertyBase? propertyBase) + { + CreateExpressions(memberInfo, propertyBase, + out var getterExpression, out var hasSentinelExpression, out var structuralGetterExpression, out var hasStructuralSentinelExpression); + return new ClrPropertyGetter( + getterExpression.Compile(), + hasSentinelExpression.Compile(), + structuralGetterExpression.Compile(), + hasStructuralSentinelExpression.Compile()); + } + + /// + /// 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. + /// + protected override MemberInfo GetMemberInfo(IPropertyBase propertyBase) + => propertyBase.GetMemberInfo(forMaterialization: false, forSet: false); + + /// + /// 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. + /// + public virtual void Create( + IPropertyBase propertyBase, + out Expression getterExpression, + out Expression hasSentinelExpression, + out Expression structuralGetterExpression, + out Expression hasStructuralSentinelExpression) + { + var boundMethod = GenericCreateExpressions.MakeGenericMethod( + propertyBase.DeclaringType.ContainingEntityType.ClrType, + propertyBase.DeclaringType.ClrType, + propertyBase.ClrType); + + try + { + var parameters = new object?[] { GetMemberInfo(propertyBase), propertyBase, null, null, null, null }; + boundMethod.Invoke(this, parameters); + getterExpression = (Expression)parameters[2]!; + hasSentinelExpression = (Expression)parameters[3]!; + structuralGetterExpression = (Expression)parameters[4]!; + hasStructuralSentinelExpression = (Expression)parameters[5]!; + } + catch (TargetInvocationException e) when (e.InnerException != null) + { + ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + throw; + } + } + + private static readonly MethodInfo GenericCreateExpressions + = typeof(ClrPropertyGetterFactory).GetMethod(nameof(CreateExpressions), BindingFlags.Instance | BindingFlags.NonPublic)!; + + private void CreateExpressions( + MemberInfo memberInfo, + IPropertyBase? propertyBase, + out Expression> getterExpression, + out Expression> hasSentinelExpression, + out Expression> structuralGetterExpression, + out Expression> hasStructuralSentinelExpression) { var entityClrType = propertyBase?.DeclaringType.ContainingEntityType.ClrType ?? typeof(TEntity); var propertyDeclaringType = propertyBase?.DeclaringType.ClrType ?? typeof(TEntity); @@ -46,17 +122,16 @@ protected override IClrPropertyGetter CreateGeneric( - Expression.Lambda>(readExpression, entityParameter).Compile(), - Expression.Lambda>(hasSentinelValueExpression, entityParameter).Compile(), - Expression.Lambda>(structuralReadExpression, structuralParameter).Compile(), - Expression.Lambda>(hasStructuralSentinelValueExpression, structuralParameter).Compile()); + getterExpression = Expression.Lambda>(readExpression, entityParameter); + hasSentinelExpression = Expression.Lambda>(hasSentinelValueExpression, entityParameter); + structuralGetterExpression = Expression.Lambda>(structuralReadExpression, structuralParameter); + hasStructuralSentinelExpression = Expression.Lambda>(hasStructuralSentinelValueExpression, structuralParameter); Expression CreateReadExpression(ParameterExpression parameter, bool fromContainingType) { if (memberInfo.DeclaringType!.IsAssignableFrom(propertyDeclaringType)) { - return PropertyBase.CreateMemberAccess(propertyBase, parameter, memberInfo, fromContainingType); + return PropertyAccessorsFactory.CreateMemberAccess(propertyBase, parameter, memberInfo, fromContainingType); } // This path handles properties that exist only on proxy types and so only exist if the instance is a proxy @@ -72,7 +147,7 @@ Expression CreateReadExpression(ParameterExpression parameter, bool fromContaini Expression.Condition( Expression.ReferenceEqual(converted, Expression.Constant(null)), Expression.Default(memberInfo.GetMemberType()), - PropertyBase.CreateMemberAccess(propertyBase, converted, memberInfo, fromContainingType)) + PropertyAccessorsFactory.CreateMemberAccess(propertyBase, converted, memberInfo, fromContainingType)) }); } diff --git a/src/EFCore/Metadata/Internal/ClrPropertyMaterializationSetterFactory.cs b/src/EFCore/Metadata/Internal/ClrPropertyMaterializationSetterFactory.cs index 5885a4b6ae5..3f405d0bdcf 100644 --- a/src/EFCore/Metadata/Internal/ClrPropertyMaterializationSetterFactory.cs +++ b/src/EFCore/Metadata/Internal/ClrPropertyMaterializationSetterFactory.cs @@ -11,12 +11,24 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// public class ClrPropertyMaterializationSetterFactory : ClrPropertySetterFactory { + private ClrPropertyMaterializationSetterFactory() + { + } + + /// + /// 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. + /// + public static new readonly ClrPropertyMaterializationSetterFactory Instance = new(); + /// /// 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. /// - public override IClrPropertySetter Create(IPropertyBase property) - => property as IClrPropertySetter ?? Create(property.GetMemberInfo(forMaterialization: true, forSet: true), property); + protected override MemberInfo GetMemberInfo(IPropertyBase propertyBase) + => propertyBase.GetMemberInfo(forMaterialization: true, forSet: true); } diff --git a/src/EFCore/Metadata/Internal/ClrPropertySetterFactory.cs b/src/EFCore/Metadata/Internal/ClrPropertySetterFactory.cs index f562e9660cc..3993a064981 100644 --- a/src/EFCore/Metadata/Internal/ClrPropertySetterFactory.cs +++ b/src/EFCore/Metadata/Internal/ClrPropertySetterFactory.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.ExceptionServices; + namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// @@ -11,6 +13,24 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// public class ClrPropertySetterFactory : ClrAccessorFactory { + /// + /// 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. + /// + protected ClrPropertySetterFactory() + { + } + + /// + /// 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. + /// + public static readonly ClrPropertySetterFactory Instance = new(); + /// /// 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 @@ -18,7 +38,7 @@ public class ClrPropertySetterFactory : ClrAccessorFactory /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public override IClrPropertySetter Create(IPropertyBase property) - => property as IClrPropertySetter ?? Create(property.GetMemberInfo(forMaterialization: false, forSet: true), property); + => property as IClrPropertySetter ?? CreateBase(property); /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -26,23 +46,87 @@ public override IClrPropertySetter Create(IPropertyBase property) /// 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. /// - protected override IClrPropertySetter CreateGeneric( + protected override IClrPropertySetter CreateGeneric( MemberInfo memberInfo, IPropertyBase? propertyBase) + { + CreateExpression(memberInfo, propertyBase, out var setter); + return new ClrPropertySetter(setter.Compile()); + } + + /// + /// 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. + /// + protected override MemberInfo GetMemberInfo(IPropertyBase propertyBase) + => propertyBase.GetMemberInfo(forMaterialization: false, forSet: true); + + /// + /// 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. + /// + public virtual void Create( + IPropertyBase propertyBase, + out Expression setterExpression) + { + var boundMethod = GenericCreateExpression.MakeGenericMethod( + propertyBase.DeclaringType.ContainingEntityType.ClrType, + propertyBase.ClrType); + + try + { + var parameters = new object?[] { GetMemberInfo(propertyBase), propertyBase, null }; + boundMethod.Invoke(this, parameters); + setterExpression = (Expression)parameters[2]!; + } + catch (TargetInvocationException e) when (e.InnerException != null) + { + ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + throw; + } + } + + private static readonly MethodInfo GenericCreateExpression + = typeof(ClrPropertySetterFactory).GetMethod(nameof(CreateExpression), BindingFlags.Instance | BindingFlags.NonPublic)!; + + private void CreateExpression( + MemberInfo memberInfo, + IPropertyBase? propertyBase, + out Expression> setter) where TEntity : class { var entityClrType = propertyBase?.DeclaringType.ContainingEntityType.ClrType ?? typeof(TEntity); var entityParameter = Expression.Parameter(entityClrType, "entity"); var propertyDeclaringType = propertyBase?.DeclaringType.ClrType ?? typeof(TEntity); var valueParameter = Expression.Parameter(typeof(TValue), "value"); var memberType = memberInfo.GetMemberType(); - var convertedParameter = memberType == typeof(TValue) - ? (Expression)valueParameter - : Expression.Convert(valueParameter, memberType); + var convertedParameter = (Expression)valueParameter; + + var propertyType = propertyBase?.ClrType ?? memberType; + if (propertyType.IsNullableType()) + { + var unwrappedType = propertyType.UnwrapNullableType(); + if (unwrappedType.IsEnum) + { + convertedParameter = Expression.Condition( + Expression.Equal(convertedParameter, Expression.Constant(null, convertedParameter.Type)), + convertedParameter, + Expression.Convert(Expression.Convert(convertedParameter, unwrappedType), convertedParameter.Type)); + } + } + + if (memberType != convertedParameter.Type) + { + convertedParameter = Expression.Convert(convertedParameter, memberType); + } Expression writeExpression; if (memberInfo.DeclaringType!.IsAssignableFrom(propertyDeclaringType)) { - writeExpression = CreateMemberAssignment(propertyBase, entityParameter); + writeExpression = CreateMemberAssignment(memberInfo, propertyBase, entityParameter, convertedParameter); } else { @@ -58,89 +142,86 @@ protected override IClrPropertySetter CreateGeneric>( + setter = Expression.Lambda>( writeExpression, entityParameter, - valueParameter).Compile(); - - var propertyType = propertyBase?.ClrType ?? memberInfo.GetMemberType(); + valueParameter); - return propertyType.IsNullableType() - && propertyType.UnwrapNullableType().IsEnum - ? new NullableEnumClrPropertySetter(setter) - : new ClrPropertySetter(setter); - - Expression CreateMemberAssignment(IPropertyBase? property, Expression instanceParameter) + static Expression CreateMemberAssignment( + MemberInfo memberInfo, + IPropertyBase? propertyBase, + Expression instanceParameter, + Expression convertedParameter) { - if (property?.DeclaringType is IComplexType complexType) + if (propertyBase?.DeclaringType is not IComplexType complexType) { - // The idea here is to create something like this: - // - // $level1 = $entity.k__BackingField; - // $level2 = $level1.k__BackingField; - // $level3 = $level2.k__BackingField; - // $level3.k__BackingField = $value; - // $level2.k__BackingField = $level3; - // $level1.k__BackingField = $level2; - // $entity.k__BackingField = $level1 - // - // That is, we create copies of value types, make the assignment, and then copy the value back. - - var chain = complexType.ComplexProperty.GetChainToComplexProperty().ToList(); - var previousLevel = instanceParameter; - - var variables = new List(); - var assignments = new List(); - var chainCount = chain.Count; - for (var i = 1; i <= chainCount; i++) - { - var currentProperty = chain[chainCount - i]; - var complexMemberInfo = currentProperty.GetMemberInfo(forMaterialization: false, forSet: false); - var complexPropertyType = complexMemberInfo.GetMemberType(); - var currentLevel = Expression.Variable(complexPropertyType, $"level{i}"); - variables.Add(currentLevel); - assignments.Add( - Expression.Assign( - currentLevel, PropertyBase.CreateMemberAccess( - currentProperty, - previousLevel, - complexMemberInfo, - fromContainingType: true))); - previousLevel = currentLevel; - } - - var propertyMemberInfo = property.GetMemberInfo(forMaterialization: false, forSet: true); - assignments.Add(Expression.MakeMemberAccess(previousLevel, propertyMemberInfo).Assign(convertedParameter)); + return propertyBase?.IsIndexerProperty() == true + ? Expression.Assign( + Expression.MakeIndex( + instanceParameter, (PropertyInfo)memberInfo, new List { Expression.Constant(propertyBase.Name) }), + convertedParameter) + : Expression.MakeMemberAccess(instanceParameter, memberInfo).Assign(convertedParameter); + } - for (var i = chainCount - 1; i >= 0; i--) - { - var currentProperty = chain[chainCount - 1 - i]; - var complexMemberInfo = currentProperty.GetMemberInfo(forMaterialization: false, forSet: true); - if (complexMemberInfo.GetMemberType().IsValueType) - { - var memberExpression = (MemberExpression)PropertyBase.CreateMemberAccess( + // The idea here is to create something like this: + // + // $level1 = $entity.k__BackingField; + // $level2 = $level1.k__BackingField; + // $level3 = $level2.k__BackingField; + // $level3.k__BackingField = $value; + // $level2.k__BackingField = $level3; + // $level1.k__BackingField = $level2; + // $entity.k__BackingField = $level1; + // + // That is, we create copies of value types, make the assignment, and then copy the value back. + + var chain = complexType.ComplexProperty.GetChainToComplexProperty(); + var previousLevel = instanceParameter; + + var variables = new List(); + var assignments = new List(); + var chainCount = chain.Count; + for (var i = chainCount; i >= 1; i--) + { + var currentProperty = chain[chainCount - i]; + var complexMemberInfo = currentProperty.GetMemberInfo(forMaterialization: false, forSet: false); + var complexPropertyType = complexMemberInfo.GetMemberType(); + var currentLevel = Expression.Variable(complexPropertyType, $"level{chainCount + 1 - i}"); + variables.Add(currentLevel); + assignments.Add( + Expression.Assign( + currentLevel, PropertyAccessorsFactory.CreateMemberAccess( currentProperty, - i == 0 ? instanceParameter : variables[i - 1], + previousLevel, complexMemberInfo, - fromContainingType: true); + fromContainingType: true))); + previousLevel = currentLevel; + } - assignments.Add(memberExpression.Assign(variables[i])); - } - } + var propertyMemberInfo = propertyBase.GetMemberInfo(forMaterialization: false, forSet: true); + assignments.Add(Expression.MakeMemberAccess(previousLevel, propertyMemberInfo).Assign(convertedParameter)); - return Expression.Block(variables, assignments); + for (var i = 0; i <= chainCount - 1; i++) + { + var currentProperty = chain[chainCount - 1 - i]; + var complexMemberInfo = currentProperty.GetMemberInfo(forMaterialization: false, forSet: true); + if (complexMemberInfo.GetMemberType().IsValueType) + { + var memberExpression = (MemberExpression)PropertyAccessorsFactory.CreateMemberAccess( + currentProperty, + i == (chainCount - 1) ? instanceParameter : variables[chainCount - 2 - i], + complexMemberInfo, + fromContainingType: true); + + assignments.Add(memberExpression.Assign(variables[chainCount - 1 - i])); + } } - return propertyBase?.IsIndexerProperty() == true - ? Expression.Assign( - Expression.MakeIndex( - instanceParameter, (PropertyInfo)memberInfo, new List { Expression.Constant(propertyBase.Name) }), - convertedParameter) - : Expression.MakeMemberAccess(instanceParameter, memberInfo).Assign(convertedParameter); + return Expression.Block(variables, assignments); } } } diff --git a/src/EFCore/Metadata/Internal/CollectionTypeFactory.cs b/src/EFCore/Metadata/Internal/CollectionTypeFactory.cs index 0ad282c0895..bfb5a5ab703 100644 --- a/src/EFCore/Metadata/Internal/CollectionTypeFactory.cs +++ b/src/EFCore/Metadata/Internal/CollectionTypeFactory.cs @@ -14,6 +14,24 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// public class CollectionTypeFactory { + /// + /// 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. + /// + protected CollectionTypeFactory() + { + } + + /// + /// 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. + /// + public static readonly CollectionTypeFactory Instance = new(); + /// /// 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 @@ -37,7 +55,6 @@ public class CollectionTypeFactory // Else, return null. var elementType = collectionType.TryGetElementType(typeof(IEnumerable<>)); - if (elementType == null) { return null; diff --git a/src/EFCore/Metadata/Internal/ComplexPropertyExtensions.cs b/src/EFCore/Metadata/Internal/ComplexPropertyExtensions.cs index 91bc2a30871..1a2c8de0ee2 100644 --- a/src/EFCore/Metadata/Internal/ComplexPropertyExtensions.cs +++ b/src/EFCore/Metadata/Internal/ComplexPropertyExtensions.cs @@ -17,16 +17,13 @@ public static class ComplexPropertyExtensions /// 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. /// - public static IEnumerable GetChainToComplexProperty(this IComplexProperty property) + public static IReadOnlyList GetChainToComplexProperty(this IComplexProperty property) { - yield return property; + var chain = property.DeclaringType is IComplexType complexType + ? (List)complexType.ComplexProperty.GetChainToComplexProperty() + : new(); + chain.Add(property); - if (property.DeclaringType is IComplexType complexType) - { - foreach (var nestedProperty in complexType.ComplexProperty.GetChainToComplexProperty()) - { - yield return nestedProperty; - } - } + return chain; } } diff --git a/src/EFCore/Metadata/Internal/Navigation.cs b/src/EFCore/Metadata/Internal/Navigation.cs index 0ede23739aa..f70a2e34c86 100644 --- a/src/EFCore/Metadata/Internal/Navigation.cs +++ b/src/EFCore/Metadata/Internal/Navigation.cs @@ -305,11 +305,7 @@ public virtual IClrCollectionAccessor? CollectionAccessor ref _collectionAccessor, ref _collectionAccessorInitialized, this, - static navigation => - { - navigation.EnsureReadOnly(); - return new ClrCollectionAccessorFactory().Create(navigation); - }); + static navigation => ClrCollectionAccessorFactory.Instance.Create(navigation)); /// /// Runs the conventions when an annotation was set or removed. diff --git a/src/EFCore/Metadata/Internal/Property.cs b/src/EFCore/Metadata/Internal/Property.cs index 4c74584ce15..f3686ed120b 100644 --- a/src/EFCore/Metadata/Internal/Property.cs +++ b/src/EFCore/Metadata/Internal/Property.cs @@ -24,7 +24,6 @@ public class Property : PropertyBase, IMutableProperty, IConventionProperty, IPr private object? _sentinel; private ValueGenerated? _valueGenerated; private CoreTypeMapping? _typeMapping; - private IComparer? _currentValueComparer; private ConfigurationSource? _typeConfigurationSource; private ConfigurationSource? _isNullableConfigurationSource; @@ -33,6 +32,9 @@ public class Property : PropertyBase, IMutableProperty, IConventionProperty, IPr private ConfigurationSource? _valueGeneratedConfigurationSource; private ConfigurationSource? _typeMappingConfigurationSource; + // Warning: Never access these fields directly as access needs to be thread-safe + private IComparer? _currentValueComparer; + /// /// 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 @@ -1093,14 +1095,23 @@ public virtual CoreTypeMapping? TypeMapping /// 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. /// - public virtual IComparer CurrentValueComparer + public virtual IComparer GetCurrentValueComparer() => NonCapturingLazyInitializer.EnsureInitialized( ref _currentValueComparer, this, static property => { property.EnsureReadOnly(); - return new CurrentValueComparerFactory().Create(property); + return CurrentValueComparerFactory.Instance.Create(property); }); + /// + /// 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. + /// + public virtual void SetCurrentValueComparer(IComparer comparer) + => _currentValueComparer = comparer; + /// /// 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 @@ -2036,16 +2047,6 @@ void IMutableProperty.SetProviderClrType(Type? providerClrType) providerClrType, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); - /// - /// 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. - /// - [DebuggerStepThrough] - IComparer IProperty.GetCurrentValueComparer() - => CurrentValueComparer; - /// /// 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 diff --git a/src/EFCore/Metadata/Internal/PropertyAccessorsFactory.cs b/src/EFCore/Metadata/Internal/PropertyAccessorsFactory.cs index 324a63d96ed..617f7f9c520 100644 --- a/src/EFCore/Metadata/Internal/PropertyAccessorsFactory.cs +++ b/src/EFCore/Metadata/Internal/PropertyAccessorsFactory.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.ExceptionServices; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; @@ -15,6 +16,18 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; /// public class PropertyAccessorsFactory { + private PropertyAccessorsFactory() + { + } + + /// + /// 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. + /// + public static readonly PropertyAccessorsFactory Instance = new(); + /// /// 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 @@ -27,22 +40,80 @@ public virtual PropertyAccessors Create(IPropertyBase propertyBase) .Invoke(null, [propertyBase])!; private static readonly MethodInfo GenericCreate - = typeof(PropertyAccessorsFactory).GetTypeInfo().GetDeclaredMethod(nameof(CreateGeneric))!; + = typeof(PropertyAccessorsFactory).GetMethod(nameof(CreateGeneric), BindingFlags.Static | BindingFlags.NonPublic)!; [UsedImplicitly] private static PropertyAccessors CreateGeneric(IPropertyBase propertyBase) { - var property = propertyBase as IProperty; + CreateExpressions( + propertyBase, + out var currentValueGetter, + out var preStoreGeneratedCurrentValueGetter, + out var originalValueGetter, + out var relationshipSnapshotGetter, + out var valueBufferGetter); return new PropertyAccessors( - CreateCurrentValueGetter(propertyBase, useStoreGeneratedValues: true), - CreateCurrentValueGetter(propertyBase, useStoreGeneratedValues: false), - property == null ? null : CreateOriginalValueGetter(property), - CreateRelationshipSnapshotGetter(propertyBase), - property == null ? null : CreateValueBufferGetter(property)); + currentValueGetter.Compile(), + preStoreGeneratedCurrentValueGetter.Compile(), + originalValueGetter?.Compile(), + relationshipSnapshotGetter.Compile(), + valueBufferGetter?.Compile()); + } + + /// + /// 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. + /// + public virtual void Create( + IPropertyBase propertyBase, + out Expression currentValueGetter, + out Expression preStoreGeneratedCurrentValueGetter, + out Expression? originalValueGetter, + out Expression relationshipSnapshotGetter, + out Expression? valueBufferGetter) + { + var boundMethod = GenericCreateExpressions.MakeGenericMethod(propertyBase.ClrType); + + try + { + var parameters = new object?[] { propertyBase, null, null, null, null, null }; + boundMethod.Invoke(null, parameters); + currentValueGetter = (Expression)parameters[1]!; + preStoreGeneratedCurrentValueGetter = (Expression)parameters[2]!; + originalValueGetter = (Expression?)parameters[3]; + relationshipSnapshotGetter = (Expression)parameters[4]!; + valueBufferGetter = (Expression?)parameters[5]; + } + catch (TargetInvocationException e) when (e.InnerException != null) + { + ExceptionDispatchInfo.Capture(e.InnerException).Throw(); + throw; + } + } + + private static readonly MethodInfo GenericCreateExpressions + = typeof(PropertyAccessorsFactory).GetMethod(nameof(CreateExpressions), BindingFlags.Static | BindingFlags.NonPublic)!; + + private static void CreateExpressions( + IPropertyBase propertyBase, + out Expression> currentValueGetter, + out Expression> preStoreGeneratedCurrentValueGetter, + out Expression>? originalValueGetter, + out Expression> relationshipSnapshotGetter, + out Expression>? valueBufferGetter) + { + var property = propertyBase as IProperty; + currentValueGetter = CreateCurrentValueGetter(propertyBase, useStoreGeneratedValues: true); + preStoreGeneratedCurrentValueGetter = CreateCurrentValueGetter(propertyBase, useStoreGeneratedValues: false); + originalValueGetter = property == null ? null : CreateOriginalValueGetter(property); + relationshipSnapshotGetter = CreateRelationshipSnapshotGetter(propertyBase); + valueBufferGetter = property == null ? null : CreateValueBufferGetter(property); } - private static Func CreateCurrentValueGetter( + private static Expression> CreateCurrentValueGetter( IPropertyBase propertyBase, bool useStoreGeneratedValues) { @@ -71,7 +142,7 @@ private static Func CreateCurrentValueGetter CreateCurrentValueGetter>( currentValueExpression, - entryParameter) - .Compile(); + entryParameter); } - private static Func CreateOriginalValueGetter(IProperty property) + private static Expression> CreateOriginalValueGetter(IProperty property) { var entryParameter = Expression.Parameter(typeof(InternalEntityEntry), "entry"); var originalValuesIndex = property.GetOriginalValueIndex(); @@ -158,11 +228,10 @@ private static Func CreateOriginalValueGetter CreateRelationshipSnapshotGetter(IPropertyBase propertyBase) + private static Expression> CreateRelationshipSnapshotGetter(IPropertyBase propertyBase) { var entryParameter = Expression.Parameter(typeof(InternalEntityEntry), "entry"); var relationshipIndex = (propertyBase as IProperty)?.GetRelationshipIndex() ?? -1; @@ -178,11 +247,10 @@ private static Func CreateRelationshipSnapshotGe entryParameter, InternalEntityEntry.MakeGetCurrentValueMethod(typeof(TProperty)), Expression.Constant(propertyBase)), - entryParameter) - .Compile(); + entryParameter); } - private static Func CreateValueBufferGetter(IProperty property) + private static Expression> CreateValueBufferGetter(IProperty property) { var valueBufferParameter = Expression.Parameter(typeof(ValueBuffer), "valueBuffer"); @@ -191,7 +259,66 @@ private static Func CreateValueBufferGetter(IProperty prope valueBufferParameter, ValueBuffer.GetValueMethod, Expression.Constant(property.GetIndex())), - valueBufferParameter) - .Compile(); + valueBufferParameter); + } + + /// + /// 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. + /// + public static readonly MethodInfo ContainsKeyMethod = + typeof(IDictionary).GetMethod(nameof(IDictionary.ContainsKey), new[] { typeof(string) })!; + + /// + /// 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. + /// + public static Expression CreateMemberAccess( + IPropertyBase? property, + Expression instanceExpression, + MemberInfo memberInfo, + bool fromContainingType) + { + if (property?.IsIndexerProperty() == true) + { + Expression expression = Expression.MakeIndex( + instanceExpression, (PropertyInfo)memberInfo, new List { Expression.Constant(property.Name) }); + + if (property.DeclaringType.IsPropertyBag) + { + expression = Expression.Condition( + Expression.Call( + instanceExpression, ContainsKeyMethod, new List { Expression.Constant(property.Name) }), + expression, + expression.Type.GetDefaultValueConstant()); + } + + return expression; + } + + if (!fromContainingType + && property?.DeclaringType is IComplexType complexType) + { + instanceExpression = CreateMemberAccess( + complexType.ComplexProperty, + instanceExpression, + complexType.ComplexProperty.GetMemberInfo(forMaterialization: false, forSet: false), + fromContainingType); + + if (!instanceExpression.Type.IsValueType + || instanceExpression.Type.IsNullableValueType()) + { + return Expression.Condition( + Expression.Equal(instanceExpression, Expression.Constant(null)), + Expression.Default(memberInfo.GetMemberType()), + Expression.MakeMemberAccess(instanceExpression, memberInfo)); + } + } + + return Expression.MakeMemberAccess(instanceExpression, memberInfo); } } diff --git a/src/EFCore/Metadata/Internal/PropertyBase.cs b/src/EFCore/Metadata/Internal/PropertyBase.cs index c1a3321f53c..d8b9503b4cb 100644 --- a/src/EFCore/Metadata/Internal/PropertyBase.cs +++ b/src/EFCore/Metadata/Internal/PropertyBase.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; namespace Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -354,7 +353,7 @@ public virtual IClrPropertyGetter Getter ref _getter, this, static property => { property.EnsureReadOnly(); - return new ClrPropertyGetterFactory().Create(property); + return ClrPropertyGetterFactory.Instance.Create(property); }); /// @@ -368,7 +367,7 @@ public virtual IClrPropertySetter GetSetter() ref _setter, this, static property => { property.EnsureReadOnly(); - return new ClrPropertySetterFactory().Create(property); + return ClrPropertySetterFactory.Instance.Create(property); }); /// @@ -382,7 +381,7 @@ public virtual IClrPropertySetter MaterializationSetter ref _materializationSetter, this, static property => { property.EnsureReadOnly(); - return new ClrPropertyMaterializationSetterFactory().Create(property); + return ClrPropertyMaterializationSetterFactory.Instance.Create(property); }); /// @@ -396,64 +395,9 @@ public virtual PropertyAccessors Accessors ref _accessors, this, static property => { property.EnsureReadOnly(); - return new PropertyAccessorsFactory().Create(property); + return PropertyAccessorsFactory.Instance.Create(property); }); - /// - /// 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. - /// - public static Expression CreateMemberAccess( - IPropertyBase? property, - Expression instanceExpression, - MemberInfo memberInfo, - bool fromContainingType) - { - if (property?.IsIndexerProperty() == true) - { - Expression expression = Expression.MakeIndex( - instanceExpression, (PropertyInfo)memberInfo, new List { Expression.Constant(property.Name) }); - - if (property.DeclaringType.IsPropertyBag) - { - expression = Expression.Condition( - Expression.Call( - instanceExpression, ShadowValuesFactoryFactory.ContainsKeyMethod, new List { Expression.Constant(property.Name) }), - expression, - expression.Type.GetDefaultValueConstant()); - } - - return expression; - } - - if (!fromContainingType - && property?.DeclaringType is IComplexType complexType) - { - instanceExpression = CreateMemberAccess( - complexType.ComplexProperty, - instanceExpression, - complexType.ComplexProperty.GetMemberInfo(forMaterialization: false, forSet: false), - fromContainingType); - - if (!instanceExpression.Type.IsValueType - || instanceExpression.Type.IsNullableValueType()) - { - var instanceVariable = Expression.Variable(instanceExpression.Type, "instance"); - return Expression.Block( - new[] { instanceVariable }, - Expression.Assign(instanceVariable, instanceExpression), - Expression.Condition( - Expression.Equal(instanceVariable, Expression.Constant(null)), - Expression.Default(memberInfo.GetMemberType()), - Expression.MakeMemberAccess(instanceExpression, memberInfo))); - } - } - - return Expression.MakeMemberAccess(instanceExpression, memberInfo); - } - /// /// 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 diff --git a/src/EFCore/Metadata/Internal/SkipNavigation.cs b/src/EFCore/Metadata/Internal/SkipNavigation.cs index 5b56e1a6fc5..371e1011d34 100644 --- a/src/EFCore/Metadata/Internal/SkipNavigation.cs +++ b/src/EFCore/Metadata/Internal/SkipNavigation.cs @@ -360,7 +360,7 @@ public virtual IClrCollectionAccessor? CollectionAccessor static navigation => { navigation.EnsureReadOnly(); - return new ClrCollectionAccessorFactory().Create(navigation); + return ClrCollectionAccessorFactory.Instance.Create(navigation); }); /// @@ -374,7 +374,7 @@ public virtual ICollectionLoader ManyToManyLoader ref _manyToManyLoader, this, static navigation => { navigation.EnsureReadOnly(); - return new ManyToManyLoaderFactory().Create(navigation); + return ManyToManyLoaderFactory.Instance.Create(navigation); }); /// diff --git a/src/EFCore/Metadata/RuntimeEntityType.cs b/src/EFCore/Metadata/RuntimeEntityType.cs index 415375d4de2..f72de6acb4d 100644 --- a/src/EFCore/Metadata/RuntimeEntityType.cs +++ b/src/EFCore/Metadata/RuntimeEntityType.cs @@ -849,8 +849,15 @@ public virtual InstantiationBinding? ServiceOnlyConstructorBinding /// 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. /// + [EntityFrameworkInternal] public virtual PropertyCounts Counts - => NonCapturingLazyInitializer.EnsureInitialized(ref _counts, this, static entityType => entityType.CalculateCounts()); + { + get => NonCapturingLazyInitializer.EnsureInitialized(ref _counts, this, static entityType => + entityType.CalculateCounts()); + + [DebuggerStepThrough] + set => _counts = value; + } /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -1418,6 +1425,16 @@ public virtual void SetTemporaryValuesFactory(Func factory) => _emptyShadowValuesFactory = factory; + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetShadowValuesFactory(Func, ISnapshot> factory) + => _shadowValuesFactory = factory; + /// Func IRuntimeEntityType.OriginalValuesFactory => NonCapturingLazyInitializer.EnsureInitialized( diff --git a/src/EFCore/Metadata/RuntimeNavigation.cs b/src/EFCore/Metadata/RuntimeNavigation.cs index 06c23de8a7c..5fc47a790be 100644 --- a/src/EFCore/Metadata/RuntimeNavigation.cs +++ b/src/EFCore/Metadata/RuntimeNavigation.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -78,6 +79,34 @@ public override RuntimeTypeBase DeclaringType public override object? Sentinel => null; + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetCollectionAccessor( + Func? getCollection, + Action? setCollection, + Action? setCollectionForMaterialization, + Func, TCollection>? createAndSetCollection, + Func? createCollection) + where TEntity : class + where TCollection : class, IEnumerable + where TElement : class + { + _collectionAccessor = new ClrICollectionAccessor( + Name, + ((INavigation)this).IsShadowProperty(), + getCollection, + setCollection, + setCollectionForMaterialization, + createAndSetCollection, + createCollection); + _collectionAccessorInitialized = true; + } + /// /// Returns a string that represents the current object. /// @@ -111,5 +140,9 @@ IReadOnlyForeignKey IReadOnlyNavigation.ForeignKey ref _collectionAccessor, ref _collectionAccessorInitialized, this, - static navigation => new ClrCollectionAccessorFactory().Create(navigation)); + static navigation => ((INavigationBase)navigation).IsCollection + ? RuntimeFeature.IsDynamicCodeSupported + ? ClrCollectionAccessorFactory.Instance.Create(navigation) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel) + : null); } diff --git a/src/EFCore/Metadata/RuntimeProperty.cs b/src/EFCore/Metadata/RuntimeProperty.cs index d817b2802f2..7fc34d2caeb 100644 --- a/src/EFCore/Metadata/RuntimeProperty.cs +++ b/src/EFCore/Metadata/RuntimeProperty.cs @@ -28,10 +28,10 @@ public class RuntimeProperty : RuntimePropertyBase, IProperty private readonly ValueConverter? _valueConverter; private ValueComparer? _valueComparer; private ValueComparer? _keyValueComparer; + private IComparer? _currentValueComparer; private ValueComparer? _providerValueComparer; private readonly JsonValueReaderWriter? _jsonValueReaderWriter; private CoreTypeMapping? _typeMapping; - private IComparer? _currentValueComparer; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -239,20 +239,29 @@ public virtual CoreTypeMapping TypeMapping set => _typeMapping = value; } + /// + /// 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. + /// + [DebuggerStepThrough] + public virtual void SetCurrentValueComparer(IComparer comparer) + => _currentValueComparer = comparer; + /// [DebuggerStepThrough] IComparer IProperty.GetCurrentValueComparer() => NonCapturingLazyInitializer.EnsureInitialized( ref _currentValueComparer, this, static property => - new CurrentValueComparerFactory().Create(property)); + CurrentValueComparerFactory.Instance.Create(property)); - private ValueComparer GetValueComparer() - => (GetValueComparer(null) ?? TypeMapping.Comparer) - .ToNullableComparer(ClrType)!; - - private ValueComparer GetKeyValueComparer() - => (GetKeyValueComparer(null) ?? TypeMapping.KeyComparer) - .ToNullableComparer(ClrType)!; + /// + public virtual ValueComparer GetValueComparer() + => NonCapturingLazyInitializer.EnsureInitialized( + ref _valueComparer, this, + static property => (property.GetValueComparer(null) ?? property.TypeMapping.Comparer) + .ToNullableComparer(property.ClrType)!); private ValueComparer? GetValueComparer(HashSet? checkedProperties) { @@ -280,6 +289,13 @@ private ValueComparer GetKeyValueComparer() return principal.GetValueComparer(checkedProperties); } + /// + public virtual ValueComparer GetKeyValueComparer() + => NonCapturingLazyInitializer.EnsureInitialized( + ref _keyValueComparer, this, + static property => (property.GetKeyValueComparer(null) ?? property.TypeMapping.KeyComparer) + .ToNullableComparer(property.ClrType)!); + private ValueComparer? GetKeyValueComparer(HashSet? checkedProperties) { if (_keyValueComparer != null) @@ -430,30 +446,12 @@ PropertySaveBehavior IReadOnlyProperty.GetAfterSaveBehavior() /// [DebuggerStepThrough] ValueComparer? IReadOnlyProperty.GetValueComparer() - => NonCapturingLazyInitializer.EnsureInitialized( - ref _valueComparer, this, - static property => property.GetValueComparer()); - - /// - [DebuggerStepThrough] - ValueComparer IProperty.GetValueComparer() - => NonCapturingLazyInitializer.EnsureInitialized( - ref _valueComparer, this, - static property => property.GetValueComparer()); + => GetValueComparer(); /// [DebuggerStepThrough] ValueComparer? IReadOnlyProperty.GetKeyValueComparer() - => NonCapturingLazyInitializer.EnsureInitialized( - ref _keyValueComparer, this, - static property => property.GetKeyValueComparer()); - - /// - [DebuggerStepThrough] - ValueComparer IProperty.GetKeyValueComparer() - => NonCapturingLazyInitializer.EnsureInitialized( - ref _keyValueComparer, this, - static property => property.GetKeyValueComparer()); + => GetKeyValueComparer(); /// [DebuggerStepThrough] diff --git a/src/EFCore/Metadata/RuntimePropertyBase.cs b/src/EFCore/Metadata/RuntimePropertyBase.cs index 1f6f9825f4a..0e5ddfe00b4 100644 --- a/src/EFCore/Metadata/RuntimePropertyBase.cs +++ b/src/EFCore/Metadata/RuntimePropertyBase.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -84,6 +85,74 @@ PropertyAccessMode IReadOnlyPropertyBase.GetPropertyAccessMode() /// public abstract object? Sentinel { get; } + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetPropertyIndexes(int index, int originalValueIndex, int shadowIndex, int relationshipIndex, int storeGenerationIndex) + => _indexes = new(index, originalValueIndex, shadowIndex, relationshipIndex, storeGenerationIndex); + + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetAccessors( + Func currentValueGetter, + Func preStoreGeneratedCurrentValueGetter, + Func? originalValueGetter, + Func relationshipSnapshotGetter, + Func? valueBufferGetter) + => _accessors = new( + currentValueGetter, + preStoreGeneratedCurrentValueGetter, + originalValueGetter, + relationshipSnapshotGetter, + valueBufferGetter); + + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetMaterializationSetter(Action setter) + where TEntity : class + => _materializationSetter = new ClrPropertySetter(setter); + + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetSetter(Action setter) + where TEntity : class + => _setter = new ClrPropertySetter(setter); + + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetGetter( + Func getter, + Func hasDefaultValue, + Func structuralTypeGetter, + Func hasStructuralTypeSentinelValue) + where TEntity : class + => _getter = new ClrPropertyGetter( + getter, hasDefaultValue, structuralTypeGetter, hasStructuralTypeSentinelValue); + /// IReadOnlyTypeBase IReadOnlyPropertyBase.DeclaringType { @@ -96,7 +165,7 @@ IClrPropertySetter IRuntimePropertyBase.MaterializationSetter => NonCapturingLazyInitializer.EnsureInitialized( ref _materializationSetter, this, static property => RuntimeFeature.IsDynamicCodeSupported - ? new ClrPropertyMaterializationSetterFactory().Create(property) + ? ClrPropertyMaterializationSetterFactory.Instance.Create(property) : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// @@ -104,7 +173,7 @@ PropertyAccessors IRuntimePropertyBase.Accessors => NonCapturingLazyInitializer.EnsureInitialized( ref _accessors, this, static property => RuntimeFeature.IsDynamicCodeSupported - ? new PropertyAccessorsFactory().Create(property) + ? PropertyAccessorsFactory.Instance.Create(property) : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// @@ -127,51 +196,18 @@ Type IReadOnlyPropertyBase.ClrType get => ClrType; } - /// - /// 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. - /// - [EntityFrameworkInternal] - public virtual void SetAccessors(PropertyAccessors accessors) - => _accessors = accessors; - - /// - /// 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. - /// - [EntityFrameworkInternal] - public virtual void SetSetter(Action setter) - where TEntity : class - => _setter = new ClrPropertySetter(setter); - - /// - /// 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. - /// - [EntityFrameworkInternal] - public virtual void SetGetter( - Func getter, - Func hasDefaultValue, - Func structuralTypeGetter, - Func hasStructuralTypeSentinelValue) - where TEntity : class - => _getter = new ClrPropertyGetter( - getter, hasDefaultValue, structuralTypeGetter, hasStructuralTypeSentinelValue); - /// IClrPropertySetter IRuntimePropertyBase.GetSetter() => NonCapturingLazyInitializer.EnsureInitialized( - ref _setter, this, static property => new ClrPropertySetterFactory().Create(property)); + ref _setter, this, static property => RuntimeFeature.IsDynamicCodeSupported + ? ClrPropertySetterFactory.Instance.Create(property) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); /// [DebuggerStepThrough] IClrPropertyGetter IPropertyBase.GetGetter() => NonCapturingLazyInitializer.EnsureInitialized( - ref _getter, this, static property => new ClrPropertyGetterFactory().Create(property)); + ref _getter, this, static property => RuntimeFeature.IsDynamicCodeSupported + ? ClrPropertyGetterFactory.Instance.Create(property) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); } diff --git a/src/EFCore/Metadata/RuntimeSkipNavigation.cs b/src/EFCore/Metadata/RuntimeSkipNavigation.cs index 3747cb8a226..73eb8d5ef17 100644 --- a/src/EFCore/Metadata/RuntimeSkipNavigation.cs +++ b/src/EFCore/Metadata/RuntimeSkipNavigation.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; @@ -103,6 +104,34 @@ public override RuntimeTypeBase DeclaringType public override object? Sentinel => null; + /// + /// 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. + /// + [EntityFrameworkInternal] + public virtual void SetCollectionAccessor( + Func? getCollection, + Action? setCollection, + Action? setCollectionForMaterialization, + Func, TCollection>? createAndSetCollection, + Func? createCollection) + where TEntity : class + where TCollection : class, IEnumerable + where TElement : class + { + _collectionAccessor = new ClrICollectionAccessor( + Name, + ((ISkipNavigation)this).IsShadowProperty(), + getCollection, + setCollection, + setCollectionForMaterialization, + createAndSetCollection, + createCollection); + _collectionAccessorInitialized = true; + } + /// /// Returns a string that represents the current object. /// @@ -170,10 +199,17 @@ bool IReadOnlyNavigationBase.IsCollection ref _collectionAccessor, ref _collectionAccessorInitialized, this, - static navigation => new ClrCollectionAccessorFactory().Create(navigation)); + static navigation => ((INavigationBase)navigation).IsCollection + ? RuntimeFeature.IsDynamicCodeSupported + ? ClrCollectionAccessorFactory.Instance.Create(navigation) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel) + : null); /// ICollectionLoader IRuntimeSkipNavigation.GetManyToManyLoader() => NonCapturingLazyInitializer.EnsureInitialized( - ref _manyToManyLoader, this, static navigation => new ManyToManyLoaderFactory().Create(navigation)); + ref _manyToManyLoader, this, static navigation => + RuntimeFeature.IsDynamicCodeSupported + ? ManyToManyLoaderFactory.Instance.Create(navigation) + : throw new InvalidOperationException(CoreStrings.NativeAotNoCompiledModel)); } diff --git a/src/EFCore/Query/Internal/EntityMaterializerSource.cs b/src/EFCore/Query/Internal/EntityMaterializerSource.cs index d690c501944..a4046b3b6e8 100644 --- a/src/EFCore/Query/Internal/EntityMaterializerSource.cs +++ b/src/EFCore/Query/Internal/EntityMaterializerSource.cs @@ -23,9 +23,15 @@ private static readonly MethodInfo InjectableServiceInjectedMethod private readonly List _bindingInterceptors; private readonly IMaterializationInterceptor? _materializationInterceptor; - private static readonly MethodInfo PopulateListMethod + /// + /// 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. + /// + public static readonly MethodInfo PopulateListMethod = typeof(EntityMaterializerSource).GetMethod( - nameof(PopulateList), BindingFlags.NonPublic | BindingFlags.Static)!; + nameof(PopulateList), BindingFlags.Public | BindingFlags.Static)!; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -167,7 +173,12 @@ static Expression CreateMemberAssignment(Expression parameter, MemberInfo member { if (property is IProperty { IsPrimitiveCollection: true, ClrType.IsArray: false }) { + var genericMethod = PopulateListMethod.MakeGenericMethod( + property.ClrType.TryGetElementType(typeof(IEnumerable<>))!); var currentVariable = Expression.Variable(property.ClrType); + var convertedVariable = genericMethod.GetParameters()[1].ParameterType.IsAssignableFrom(currentVariable.Type) + ? (Expression)currentVariable + : Expression.Convert(currentVariable, genericMethod.GetParameters()[1].ParameterType); return Expression.Block( new[] { currentVariable }, Expression.Assign( @@ -179,9 +190,9 @@ static Expression CreateMemberAssignment(Expression parameter, MemberInfo member Expression.ReferenceEqual(value, Expression.Constant(null))), Expression.MakeMemberAccess(parameter, memberInfo).Assign(value), Expression.Call( - PopulateListMethod.MakeGenericMethod(property.ClrType.TryGetElementType(typeof(IEnumerable<>))!), + genericMethod, value, - currentVariable) + convertedVariable) )); } @@ -194,7 +205,13 @@ static Expression CreateMemberAssignment(Expression parameter, MemberInfo member } } - private static IList PopulateList(IList buffer, IList target) + /// + /// 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. + /// + public static IList PopulateList(IEnumerable buffer, IList target) { target.Clear(); foreach (var value in buffer) diff --git a/src/EFCore/Storage/ValueBuffer.cs b/src/EFCore/Storage/ValueBuffer.cs index af48101eac3..f681f1dee00 100644 --- a/src/EFCore/Storage/ValueBuffer.cs +++ b/src/EFCore/Storage/ValueBuffer.cs @@ -52,8 +52,11 @@ public object? this[int index] set => _values[index] = value; } + internal static readonly PropertyInfo Indexer + = typeof(ValueBuffer).GetRuntimeProperties().Single(p => p.GetIndexParameters().Length > 0); + internal static readonly MethodInfo GetValueMethod - = typeof(ValueBuffer).GetRuntimeProperties().Single(p => p.GetIndexParameters().Length > 0).GetMethod!; + = Indexer.GetMethod!; /// /// Gets the number of values in this buffer. diff --git a/src/Shared/SharedTypeExtensions.cs b/src/Shared/SharedTypeExtensions.cs index 73fd2a2ef31..ca9ed522a4e 100644 --- a/src/Shared/SharedTypeExtensions.cs +++ b/src/Shared/SharedTypeExtensions.cs @@ -372,6 +372,27 @@ public static IEnumerable GetMembersInHierarchy( string name) => type.GetMembersInHierarchy().Where(m => m.Name == name); + public static MethodInfo GetGenericMethod( + [DynamicallyAccessedMembers( + DynamicallyAccessedMemberTypes.PublicMethods + | DynamicallyAccessedMemberTypes.NonPublicMethods)] + this Type type, + string name, + int genericParameterCount, + BindingFlags bindingFlags, + Func parameterGenerator, + bool? @override = null) + => type.GetMethods(bindingFlags) + .Single( + mi => mi.Name == name + && ((genericParameterCount == 0 && !mi.IsGenericMethod) + || (mi.IsGenericMethod && mi.GetGenericArguments().Length == genericParameterCount)) + && mi.GetParameters().Select(e => e.ParameterType).SequenceEqual( + parameterGenerator( + type.IsGenericType ? type.GetGenericArguments() : Array.Empty(), + mi.IsGenericMethod ? mi.GetGenericArguments() : Array.Empty())) + && (!@override.HasValue || (@override.Value == (mi.GetBaseDefinition().DeclaringType != mi.DeclaringType)))); + private static readonly Dictionary CommonTypeDictionary = new() { #pragma warning disable IDE0034 // Simplify 'default' expression - default causes default(object) diff --git a/test/EFCore.Cosmos.FunctionalTests/Scaffolding/Baselines/Basic_cosmos_model/DataEntityType.cs b/test/EFCore.Cosmos.FunctionalTests/Scaffolding/Baselines/Basic_cosmos_model/DataEntityType.cs index 2ddcc99ef4d..e14aeb8b9a1 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Scaffolding/Baselines/Basic_cosmos_model/DataEntityType.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Scaffolding/Baselines/Basic_cosmos_model/DataEntityType.cs @@ -1,14 +1,19 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal; using Microsoft.EntityFrameworkCore.Cosmos.ValueGeneration.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Newtonsoft.Json.Linq; @@ -34,6 +39,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -49,12 +60,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var partitionId = runtimeEntityType.AddProperty( "PartitionId", typeof(long?), afterSaveBehavior: PropertySaveBehavior.Throw, providerPropertyType: typeof(string)); + partitionId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: -1); partitionId.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -76,6 +94,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (long v) => string.Format(CultureInfo.InvariantCulture, "{0}", (object)v), (string v) => long.Parse(v, NumberStyles.Any, CultureInfo.InvariantCulture)))); + partitionId.SetCurrentValueComparer(new EntryCurrentValueComparer(partitionId)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -83,19 +102,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[2]); + blob.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => v1 == null ? v2 == null : v2 != null && v1.Length == v2.Length && v1 == v2 || v1.Zip(v2, (byte v1, byte v2) => v1 == v2).All((bool v) => v), - (Byte[] v) => v.Aggregate(new HashCode(), (HashCode h, byte e) => ValueComparer.Add(h, (int)e), (HashCode h) => h.ToHashCode()), - (Byte[] v) => v.Select((byte v) => v).ToArray()), + (byte[] v1, byte[] v2) => v1 == null ? v2 == null : v2 != null && v1.Length == v2.Length && v1 == v2 || v1.Zip(v2, (byte v1, byte v2) => v1 == v2).All((bool v) => v), + (byte[] v) => v.Aggregate(new HashCode(), (HashCode h, byte e) => ValueComparer.Add(h, (int)e), (HashCode h) => h.ToHashCode()), + (byte[] v) => v.Select((byte v) => v).ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), clrType: typeof(byte[]), jsonValueReaderWriter: JsonByteArrayReaderWriter.Instance); blob.AddAnnotation("Cosmos:PropertyName", "JsonBlob"); @@ -105,6 +145,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new IdValueGeneratorFactory().Create); + __id.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: 2, + relationshipIndex: 2, + storeGenerationIndex: -1); __id.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -120,6 +166,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v), clrType: typeof(string), jsonValueReaderWriter: JsonStringReaderWriter.Instance); + __id.SetCurrentValueComparer(new EntryCurrentValueComparer(__id)); __id.AddAnnotation("Cosmos:PropertyName", "id"); var __jObject = runtimeEntityType.AddProperty( @@ -129,6 +176,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + __jObject.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: 3, + relationshipIndex: -1, + storeGenerationIndex: 0); __jObject.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( (JObject v1, JObject v2) => object.Equals(v1, v2), @@ -153,6 +206,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + _etag.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 4, + relationshipIndex: -1, + storeGenerationIndex: 1); _etag.TypeMapping = CosmosTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -181,6 +240,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var partitionId = runtimeEntityType.FindProperty("PartitionId")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + var __id = runtimeEntityType.FindProperty("__id")!; + var __jObject = runtimeEntityType.FindProperty("__jObject")!; + var _etag = runtimeEntityType.FindProperty("_etag")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot, byte[], string, JObject, string>(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue>(partitionId) == null ? null : ((ValueComparer>)partitionId.GetValueComparer()).Snapshot(source.GetCurrentValue>(partitionId)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob)), source.GetCurrentValue(__id) == null ? null : ((ValueComparer)__id.GetValueComparer()).Snapshot(source.GetCurrentValue(__id)), source.GetCurrentValue(__jObject) == null ? null : ((ValueComparer)__jObject.GetValueComparer()).Snapshot(source.GetCurrentValue(__jObject)), source.GetCurrentValue(_etag) == null ? null : ((ValueComparer)_etag.GetValueComparer()).Snapshot(source.GetCurrentValue(_etag))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(default(JObject) == null ? null : ((ValueComparer)__jObject.GetValueComparer()).Snapshot(default(JObject)), default(string) == null ? null : ((ValueComparer)_etag.GetValueComparer()).Snapshot(default(string)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(JObject), default(string))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot, string, JObject, string>(source.ContainsKey("Id") ? (int)source["Id"] : 0, source.ContainsKey("PartitionId") ? (Nullable)source["PartitionId"] : null, source.ContainsKey("__id") ? (string)source["__id"] : null, source.ContainsKey("__jObject") ? (JObject)source["__jObject"] : null, source.ContainsKey("_etag") ? (string)source["_etag"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot, string, JObject, string>(default(int), default(Nullable), default(string), default(JObject), default(string))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot, string>(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue>(partitionId) == null ? null : ((ValueComparer>)partitionId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(partitionId)), source.GetCurrentValue(__id) == null ? null : ((ValueComparer)__id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(__id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 6, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 6, + shadowCount: 5, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Cosmos:ContainerName", "DataContainer"); runtimeEntityType.AddAnnotation("Cosmos:ETagName", "_etag"); runtimeEntityType.AddAnnotation("Cosmos:PartitionKeyName", "PartitionId"); @@ -189,5 +282,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Design.Tests/Query/LinqToCSharpTranslatorTest.cs b/test/EFCore.Design.Tests/Query/LinqToCSharpSyntaxTranslatorTest.cs similarity index 82% rename from test/EFCore.Design.Tests/Query/LinqToCSharpTranslatorTest.cs rename to test/EFCore.Design.Tests/Query/LinqToCSharpSyntaxTranslatorTest.cs index 6f66959ef01..f9c5630ac4f 100644 --- a/test/EFCore.Design.Tests/Query/LinqToCSharpTranslatorTest.cs +++ b/test/EFCore.Design.Tests/Query/LinqToCSharpSyntaxTranslatorTest.cs @@ -14,7 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Query; -public class LinqToCSharpTranslatorTest(ITestOutputHelper testOutputHelper) +public class LinqToCSharpSyntaxTranslatorTest(ITestOutputHelper testOutputHelper) { private readonly ITestOutputHelper _testOutputHelper = testOutputHelper; @@ -37,6 +37,10 @@ public void Constant_values(object constantValue, string literalRepresentation) Constant(constantValue), literalRepresentation); + [Fact] + public void Constant_DateTime_default() + => AssertExpression(Constant(default(DateTime)), "default(DateTime)"); + [Fact] public void Constant_decimal() => AssertExpression(Constant(1.5m), "1.5M"); @@ -47,19 +51,19 @@ public void Constant_null() [Fact] public void Constant_throws_on_unsupported_type() - => Assert.Throws(() => AssertExpression(Constant(default(DateTime)), "")); + => Assert.Throws(() => AssertExpression(Constant(DateTime.Now), "")); [Fact] public void Enum() - => AssertExpression(Constant(SomeEnum.One), "SomeEnum.One"); + => AssertExpression(Constant(SomeEnum.One), "LinqToCSharpSyntaxTranslatorTest.SomeEnum.One"); [Fact] public void Enum_with_multiple_values() - => AssertExpression(Constant(SomeEnum.One | SomeEnum.Two), "SomeEnum.One | SomeEnum.Two"); + => AssertExpression(Constant(SomeEnum.One | SomeEnum.Two), "LinqToCSharpSyntaxTranslatorTest.SomeEnum.One | LinqToCSharpSyntaxTranslatorTest.SomeEnum.Two"); [Fact] public void Enum_with_unknown_value() - => AssertExpression(Constant((SomeEnum)1000), "(LinqToCSharpTranslatorTest.SomeEnum)1000L"); + => AssertExpression(Constant((SomeEnum)1000), "(LinqToCSharpSyntaxTranslatorTest.SomeEnum)1000L"); [Theory] [InlineData(ExpressionType.Add, "+")] @@ -107,7 +111,7 @@ public void Private_instance_field_SimpleAssign() Assign( Field(Parameter(typeof(Blog), "blog"), "_privateField"), Constant(3)), - """typeof(LinqToCSharpTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(blog, 3)"""); + """typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).SetValue(blog, 3)"""); [Theory] [InlineData(ExpressionType.AddAssign, "+")] @@ -126,7 +130,31 @@ public void Private_instance_field_AssignOperators(ExpressionType expressionType expressionType, Field(Parameter(typeof(Blog), "blog"), "_privateField"), Constant(3)), - $"""typeof(LinqToCSharpTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(blog, typeof(LinqToCSharpTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(blog) {op} 3)"""); + $"""typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).SetValue(blog, (int)typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).GetValue(blog) {op} 3)"""); + + [Theory] + [InlineData(ExpressionType.AddAssign, "+")] + [InlineData(ExpressionType.MultiplyAssign, "*")] + [InlineData(ExpressionType.DivideAssign, "/")] + [InlineData(ExpressionType.ModuloAssign, "%")] + [InlineData(ExpressionType.SubtractAssign, "-")] + [InlineData(ExpressionType.AndAssign, "&")] + [InlineData(ExpressionType.OrAssign, "|")] + [InlineData(ExpressionType.LeftShiftAssign, "<<")] + [InlineData(ExpressionType.RightShiftAssign, ">>")] + [InlineData(ExpressionType.ExclusiveOrAssign, "^")] + public void Private_instance_field_AssignOperators_with_replacements(ExpressionType expressionType, string op) + => AssertExpression( + MakeBinary( + expressionType, + Field(Parameter(typeof(Blog), "blog"), "_privateField"), + Constant(3)), + $"""WritePrivateField(blog, ReadPrivateField(blog) {op} Three)""", + new Dictionary() { { 3, "Three" } }, + new Dictionary() { + { new MemberAccess(BlogPrivateField, assignment: true), "WritePrivateField" }, + { new MemberAccess(BlogPrivateField, assignment: false), "ReadPrivateField" } + }); [Theory] [InlineData(ExpressionType.Negate, "-i")] @@ -161,7 +189,7 @@ public void Unary_statement(ExpressionType expressionType, string expected) AssertStatement( Block( - variables: new[] { i }, + variables: [i], MakeUnary(expressionType, i, typeof(int))), $$""" { @@ -229,7 +257,7 @@ public void Static_property() public void Private_instance_field_read() => AssertExpression( Field(Parameter(typeof(Blog), "blog"), "_privateField"), - """typeof(LinqToCSharpTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(blog)"""); + """(int)typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).GetValue(blog)"""); [Fact] public void Private_instance_field_write() @@ -237,13 +265,13 @@ public void Private_instance_field_write() Assign( Field(Parameter(typeof(Blog), "blog"), "_privateField"), Constant(8)), - """typeof(LinqToCSharpTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(blog, 8)"""); + """typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("_privateField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).SetValue(blog, 8)"""); [Fact] public void Internal_instance_field_read() => AssertExpression( Field(Parameter(typeof(Blog), "blog"), "InternalField"), - "blog.InternalField"); + """(int)typeof(LinqToCSharpSyntaxTranslatorTest.Blog).GetField("InternalField", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly).GetValue(blog)"""); [Fact] public void Not() @@ -261,7 +289,7 @@ public void MemberInit_with_MemberAssignment() Bind(typeof(Blog).GetProperty(nameof(Blog.PublicProperty))!, Constant(8)), Bind(typeof(Blog).GetField(nameof(Blog.PublicField))!, Constant(9))), """ -new LinqToCSharpTranslatorTest.Blog("foo") +new LinqToCSharpSyntaxTranslatorTest.Blog("foo") { PublicProperty = 8, PublicField = 9 @@ -280,7 +308,7 @@ public void MemberInit_with_MemberListBinding() ElementInit(typeof(List).GetMethod(nameof(List.Add))!, Constant(8)), ElementInit(typeof(List).GetMethod(nameof(List.Add))!, Constant(9)))), """ -new LinqToCSharpTranslatorTest.Blog("foo") +new LinqToCSharpSyntaxTranslatorTest.Blog("foo") { ListOfInts = { @@ -305,7 +333,7 @@ public void MemberInit_with_MemberMemberBinding() ElementInit(typeof(List).GetMethod(nameof(List.Add))!, Constant(8)), ElementInit(typeof(List).GetMethod(nameof(List.Add))!, Constant(9))))), """ -new LinqToCSharpTranslatorTest.Blog("foo") +new LinqToCSharpSyntaxTranslatorTest.Blog("foo") { Details = { @@ -326,14 +354,14 @@ public void Method_call_instance() AssertStatement( Block( - variables: new[] { blog }, + variables: [blog], Assign(blog, New(Blog.Constructor)), Call( blog, typeof(Blog).GetMethod(nameof(Blog.SomeInstanceMethod))!)), """ { - var blog = new LinqToCSharpTranslatorTest.Blog(); + var blog = new LinqToCSharpSyntaxTranslatorTest.Blog(); blog.SomeInstanceMethod(); } """); @@ -343,13 +371,13 @@ public void Method_call_instance() public void Method_call_static() => AssertExpression( Call(ReturnsIntWithParamMethod, Constant(8)), - "LinqToCSharpTranslatorTest.ReturnsIntWithParam(8)"); + "LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(8)"); [Fact] public void Method_call_static_on_nested_type() => AssertExpression( Call(typeof(Blog).GetMethod(nameof(Blog.Static_method_on_nested_type))!), - "LinqToCSharpTranslatorTest.Blog.Static_method_on_nested_type()"); + "LinqToCSharpSyntaxTranslatorTest.Blog.Static_method_on_nested_type()"); [Fact] public void Method_call_extension() @@ -358,7 +386,7 @@ public void Method_call_extension() AssertStatement( Block( - variables: new[] { blog }, + variables: [blog], Assign(blog, New(LinqExpressionToRoslynTranslatorExtensionType.Constructor)), Call(LinqExpressionToRoslynTranslatorExtensions.SomeExtensionMethod, blog)), """ @@ -384,15 +412,15 @@ public void Method_call_generic() AssertStatement( Block( - variables: new[] { blog }, + variables: [blog], Assign(blog, New(Blog.Constructor)), Call( GenericMethod.MakeGenericMethod(typeof(Blog)), blog)), """ { - var blog = new LinqToCSharpTranslatorTest.Blog(); - LinqToCSharpTranslatorTest.GenericMethodImplementation(blog); + var blog = new LinqToCSharpSyntaxTranslatorTest.Blog(); + LinqToCSharpSyntaxTranslatorTest.GenericMethodImplementation(blog); } """); } @@ -402,10 +430,10 @@ public void Method_call_namespace_is_collected() { var (translator, _) = CreateTranslator(); var namespaces = new HashSet(); - _ = translator.TranslateExpression(Call(FooMethod), namespaces); + _ = translator.TranslateExpression(Call(FooMethod), null, namespaces); Assert.Collection( namespaces, - ns => Assert.Equal(typeof(LinqToCSharpTranslatorTest).Namespace, ns)); + ns => Assert.Equal(typeof(LinqToCSharpSyntaxTranslatorTest).Namespace, ns)); } [Fact] @@ -417,14 +445,14 @@ public void Method_call_with_in_out_ref_parameters() AssertStatement( Block( - variables: new[] { inParam, outParam, refParam }, + variables: [inParam, outParam, refParam], Call(WithInOutRefParameterMethod, [inParam, outParam, refParam])), """ { int inParam; int outParam; int refParam; - LinqToCSharpTranslatorTest.WithInOutRefParameter(in inParam, out outParam, ref refParam); + LinqToCSharpSyntaxTranslatorTest.WithInOutRefParameter(in inParam, out outParam, ref refParam); } """); } @@ -435,7 +463,7 @@ public void Instantiation() New( typeof(Blog).GetConstructor([typeof(string)])!, Constant("foo")), - """new LinqToCSharpTranslatorTest.Blog("foo")"""); + """new LinqToCSharpSyntaxTranslatorTest.Blog("foo")"""); [Fact] public void Instantiation_with_required_properties_and_parameterless_constructor() @@ -443,7 +471,7 @@ public void Instantiation_with_required_properties_and_parameterless_constructor New( typeof(BlogWithRequiredProperties).GetConstructor([])!), """ -Activator.CreateInstance() +Activator.CreateInstance() """); [Fact] @@ -460,7 +488,7 @@ public void Instantiation_with_required_properties_with_SetsRequiredMembers() New( typeof(BlogWithRequiredProperties).GetConstructor([typeof(string), typeof(int)])!, Constant("foo"), Constant(8)), - """new LinqToCSharpTranslatorTest.BlogWithRequiredProperties("foo", 8)"""); + """new LinqToCSharpSyntaxTranslatorTest.BlogWithRequiredProperties("foo", 8)"""); [Fact] public void Lambda_with_expression_body() @@ -476,7 +504,7 @@ public void Lambda_with_block_body() AssertExpression( Lambda>( Block( - variables: new[] { i }, + variables: [i], Assign(i, Constant(8)), i)), """ @@ -530,7 +558,7 @@ public void Invocation_with_argument_that_has_side_effects() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Add( @@ -538,7 +566,7 @@ public void Invocation_with_argument_that_has_side_effects() Invoke((Expression>)(f => f + f), Call(FooMethod))))), """ { - var f = LinqToCSharpTranslatorTest.Foo(); + var f = LinqToCSharpSyntaxTranslatorTest.Foo(); var i = 5 + f + f; } """); @@ -567,11 +595,11 @@ public void Conditional_statement() { if (true) { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } else { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } } """); @@ -581,7 +609,7 @@ public void IfThen_statement() { var parameter = Parameter(typeof(int), "i"); var block = Block( - variables: new[] { parameter }, + variables: [parameter], expressions: Assign(parameter, Constant(8))); AssertStatement( @@ -601,12 +629,12 @@ public void IfThenElse_statement() { var parameter1 = Parameter(typeof(int), "i"); var block1 = Block( - variables: new[] { parameter1 }, + variables: [parameter1], expressions: Assign(parameter1, Constant(8))); var parameter2 = Parameter(typeof(int), "j"); var block2 = Block( - variables: new[] { parameter2 }, + variables: [parameter2], expressions: Assign(parameter2, Constant(9))); AssertStatement( @@ -632,7 +660,7 @@ public void IfThenElse_nested() AssertStatement( Block( - variables: new[] { variable }, + variables: [variable], expressions: IfThenElse( Constant(true), Block(Assign(variable, Constant(1))), @@ -674,7 +702,7 @@ public void Conditional_expression_with_block_in_lambda() { if (true) { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); return 8; } else @@ -691,7 +719,7 @@ public void IfThen_with_block_inside_expression_block_with_lifted_statements() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Block( // We're in expression context. Do anything that will get lifted. @@ -706,11 +734,11 @@ public void IfThen_with_block_inside_expression_block_with_lifted_statements() Constant(8)))), """ { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); if (true) { - LinqToCSharpTranslatorTest.Bar(); - LinqToCSharpTranslatorTest.Baz(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Baz(); } var i = 8; @@ -744,7 +772,7 @@ public void Switch_expression_nested() AssertStatement( Block( - variables: new[] { i, j, k }, + variables: [i, j, k], Assign(j, Constant(8)), Assign( i, @@ -818,7 +846,7 @@ public void Switch_statement_without_default() AssertStatement( Block( - variables: new[] { parameter }, + variables: [parameter], expressions: Switch( Constant(7), SwitchCase(Block(typeof(void), Assign(parameter, Constant(9))), Constant(-9)), @@ -851,7 +879,7 @@ public void Switch_statement_with_default() AssertStatement( Block( - variables: new[] { parameter }, + variables: [parameter], expressions: Switch( Constant(7), Assign(parameter, Constant(0)), @@ -883,7 +911,7 @@ public void Switch_statement_with_multiple_labels() AssertStatement( Block( - variables: new[] { parameter }, + variables: [parameter], expressions: Switch( Constant(7), Assign(parameter, Constant(0)), @@ -916,7 +944,7 @@ public void Variable_assignment_uses_var() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign(i, Constant(8))), """ { @@ -932,7 +960,7 @@ public void Variable_assignment_to_null_does_not_use_var() AssertStatement( Block( - variables: new[] { s }, + variables: [s], Assign(s, Constant(null, typeof(string)))), """ { @@ -950,23 +978,23 @@ public void Variables_with_same_name_in_sibling_blocks_do_not_get_renamed() AssertStatement( Block( Block( - variables: new[] { i1 }, + variables: [i1], Assign(i1, Constant(8)), Call(ReturnsIntWithParamMethod, i1)), Block( - variables: new[] { i2 }, + variables: [i2], Assign(i2, Constant(8)), Call(ReturnsIntWithParamMethod, i2))), """ { { var i = 8; - LinqToCSharpTranslatorTest.ReturnsIntWithParam(i); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(i); } { var i = 8; - LinqToCSharpTranslatorTest.ReturnsIntWithParam(i); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(i); } } """); @@ -980,22 +1008,22 @@ public void Variable_with_same_name_in_child_block_gets_renamed() AssertStatement( Block( - variables: new[] { i1 }, + variables: [i1], Assign(i1, Constant(8)), Call(ReturnsIntWithParamMethod, i1), Block( - variables: new[] { i2 }, + variables: [i2], Assign(i2, Constant(8)), Call(ReturnsIntWithParamMethod, i2), Call(ReturnsIntWithParamMethod, i1))), """ { var i = 8; - LinqToCSharpTranslatorTest.ReturnsIntWithParam(i); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(i); { var i0 = 8; - LinqToCSharpTranslatorTest.ReturnsIntWithParam(i0); - LinqToCSharpTranslatorTest.ReturnsIntWithParam(i); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(i0); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(i); } } """); @@ -1010,7 +1038,7 @@ public void Variable_with_same_name_in_lambda_does_not_get_renamed() AssertStatement( Block( - variables: new[] { i1 }, + variables: [i1], Assign(i1, Constant(8)), Assign( f, Lambda>( @@ -1070,16 +1098,16 @@ public void Lift_block_in_assignment_context() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Block( - variables: new[] { j }, + variables: [j], Assign(j, Call(FooMethod)), Call(ReturnsIntWithParamMethod, j)))), """ { - var j = LinqToCSharpTranslatorTest.Foo(); - var i = LinqToCSharpTranslatorTest.ReturnsIntWithParam(j); + var j = LinqToCSharpSyntaxTranslatorTest.Foo(); + var i = LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(j); } """); } @@ -1095,8 +1123,8 @@ public void Lift_block_in_method_call_context() Call(BarMethod)))), """ { - LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.ReturnsIntWithParam(LinqToCSharpTranslatorTest.Bar()); + LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(LinqToCSharpSyntaxTranslatorTest.Bar()); } """); @@ -1108,20 +1136,20 @@ public void Lift_nested_block() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Block( - variables: new[] { j }, + variables: [j], Assign(j, Call(FooMethod)), Block( Call(BarMethod), Call(ReturnsIntWithParamMethod, j))))), """ { - var j = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Bar(); - var i = LinqToCSharpTranslatorTest.ReturnsIntWithParam(j); + var j = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + var i = LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(j); } """); } @@ -1133,7 +1161,7 @@ public void Binary_lifts_left_side_if_right_is_lifted() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Add( @@ -1143,9 +1171,9 @@ public void Binary_lifts_left_side_if_right_is_lifted() Call(BazMethod))))), """ { - var lifted = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Bar(); - var i = lifted + LinqToCSharpTranslatorTest.Baz(); + var lifted = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + var i = lifted + LinqToCSharpSyntaxTranslatorTest.Baz(); } """); } @@ -1157,7 +1185,7 @@ public void Binary_does_not_lift_left_side_if_it_has_no_side_effects() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Add( @@ -1167,8 +1195,8 @@ public void Binary_does_not_lift_left_side_if_it_has_no_side_effects() Call(BazMethod))))), """ { - LinqToCSharpTranslatorTest.Bar(); - var i = 5 + LinqToCSharpTranslatorTest.Baz(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + var i = 5 + LinqToCSharpSyntaxTranslatorTest.Baz(); } """); } @@ -1180,11 +1208,11 @@ public void Method_lifts_earlier_args_if_later_arg_is_lifted() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Call( - typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(MethodWithSixParams))!, + typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(MethodWithSixParams))!, Call(FooMethod), Constant(5), Block(Call(BarMethod), Call(BazMethod)), @@ -1193,12 +1221,12 @@ public void Method_lifts_earlier_args_if_later_arg_is_lifted() Call(FooMethod)))), """ { - var liftedArg = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Bar(); - var liftedArg0 = LinqToCSharpTranslatorTest.Baz(); - var liftedArg1 = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Baz(); - var i = LinqToCSharpTranslatorTest.MethodWithSixParams(liftedArg, 5, liftedArg0, liftedArg1, LinqToCSharpTranslatorTest.Bar(), LinqToCSharpTranslatorTest.Foo()); + var liftedArg = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + var liftedArg0 = LinqToCSharpSyntaxTranslatorTest.Baz(); + var liftedArg1 = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Baz(); + var i = LinqToCSharpSyntaxTranslatorTest.MethodWithSixParams(liftedArg, 5, liftedArg0, liftedArg1, LinqToCSharpSyntaxTranslatorTest.Bar(), LinqToCSharpSyntaxTranslatorTest.Foo()); } """); } @@ -1210,7 +1238,7 @@ public void New_lifts_earlier_args_if_later_arg_is_lifted() AssertStatement( Block( - variables: new[] { b }, + variables: [b], Assign( b, New( @@ -1221,9 +1249,9 @@ public void New_lifts_earlier_args_if_later_arg_is_lifted() Call(BazMethod))))), """ { - var liftedArg = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Bar(); - var b = new LinqToCSharpTranslatorTest.Blog(liftedArg, LinqToCSharpTranslatorTest.Baz()); + var liftedArg = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + var b = new LinqToCSharpSyntaxTranslatorTest.Blog(liftedArg, LinqToCSharpSyntaxTranslatorTest.Baz()); } """); } @@ -1270,7 +1298,7 @@ public void New_array_lifts_earlier_args_if_later_arg_is_lifted() // a = new[] { Foo(), { Bar(); Baz(); } } AssertStatement( Block( - variables: new[] { a }, + variables: [a], Assign( a, NewArrayInit( @@ -1281,12 +1309,12 @@ public void New_array_lifts_earlier_args_if_later_arg_is_lifted() Call(BazMethod))))), """ { - var liftedArg = LinqToCSharpTranslatorTest.Foo(); - LinqToCSharpTranslatorTest.Bar(); + var liftedArg = LinqToCSharpSyntaxTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Bar(); var a = new int[] { liftedArg, - LinqToCSharpTranslatorTest.Baz() + LinqToCSharpSyntaxTranslatorTest.Baz() }; } """); @@ -1300,10 +1328,10 @@ public void Lift_variable_in_expression_block() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Block( - variables: new[] { j }, + variables: [j], Block( Call(FooMethod), Assign(j, Constant(8)), @@ -1311,7 +1339,7 @@ public void Lift_variable_in_expression_block() """ { int j; - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); j = 8; var i = 9; } @@ -1331,8 +1359,8 @@ public void Lift_block_in_lambda_body_expression() """ () => { - LinqToCSharpTranslatorTest.Foo(); - return LinqToCSharpTranslatorTest.ReturnsIntWithParam(LinqToCSharpTranslatorTest.Bar()); + LinqToCSharpSyntaxTranslatorTest.Foo(); + return LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(LinqToCSharpSyntaxTranslatorTest.Bar()); } """); @@ -1377,7 +1405,7 @@ public void Lift_switch_expression() AssertStatement( Block( - variables: new[] { i, j }, + variables: [i, j], Assign(j, Constant(8)), Assign( i, @@ -1399,8 +1427,8 @@ public void Lift_switch_expression() { case 8: { - k = LinqToCSharpTranslatorTest.Foo(); - i = LinqToCSharpTranslatorTest.ReturnsIntWithParam(k); + k = LinqToCSharpSyntaxTranslatorTest.Foo(); + i = LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(k); break; } @@ -1425,7 +1453,7 @@ public void Lift_nested_switch_expression() AssertStatement( Block( - variables: new[] { i, j, k }, + variables: [i, j, k], Assign(j, Constant(8)), Assign( i, @@ -1439,7 +1467,7 @@ public void Lift_nested_switch_expression() defaultBody: Constant(0), SwitchCase( Block( - variables: new[] { l }, + variables: [l], Assign(l, Call(FooMethod)), Call(ReturnsIntWithParamMethod, l)), Constant(200)), @@ -1461,8 +1489,8 @@ public void Lift_nested_switch_expression() { case 200: { - var l = LinqToCSharpTranslatorTest.Foo(); - i = LinqToCSharpTranslatorTest.ReturnsIntWithParam(l); + var l = LinqToCSharpSyntaxTranslatorTest.Foo(); + i = LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(l); break; } @@ -1492,7 +1520,7 @@ public void Lift_non_literal_switch_expression() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign( i, Switch( @@ -1514,14 +1542,14 @@ public void Lift_non_literal_switch_expression() int i; if (blog1 == blog2) { - LinqToCSharpTranslatorTest.ReturnsIntWithParam(8); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(8); i = 1; } else { if (blog1 == blog3) { - LinqToCSharpTranslatorTest.ReturnsIntWithParam(9); + LinqToCSharpSyntaxTranslatorTest.ReturnsIntWithParam(9); i = 2; } else @@ -1575,7 +1603,7 @@ public void Goto_with_named_label() { goto label1; label1: - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } """); } @@ -1615,7 +1643,7 @@ public void Goto_outside_label() { if (true) { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); goto unnamedLabel; } @@ -1663,7 +1691,7 @@ public void Loop_statement_infinite() """ while (true) { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } """); @@ -1676,7 +1704,7 @@ public void Loop_statement_with_break_and_continue() AssertStatement( Block( - variables: new[] { i }, + variables: [i], Assign(i, Constant(0)), Loop( Block( @@ -1729,15 +1757,15 @@ public void Try_catch_statement() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } catch (InvalidOperationException e) { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } catch (InvalidOperationException e) { - LinqToCSharpTranslatorTest.Baz(); + LinqToCSharpSyntaxTranslatorTest.Baz(); } """); } @@ -1751,11 +1779,11 @@ public void Try_finally_statement() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } finally { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } """); @@ -1780,20 +1808,20 @@ public void Try_catch_finally_statement() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } catch (InvalidOperationException e) { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } catch (InvalidOperationException e)when (e.Message == "foo") { - LinqToCSharpTranslatorTest.Baz(); + LinqToCSharpSyntaxTranslatorTest.Baz(); } finally { - LinqToCSharpTranslatorTest.Bar(); - LinqToCSharpTranslatorTest.Baz(); + LinqToCSharpSyntaxTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Baz(); } """); } @@ -1815,11 +1843,11 @@ public void Try_catch_statement_with_filter() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } catch (InvalidOperationException e)when (e.Message == "foo") { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } """); } @@ -1835,11 +1863,11 @@ public void Try_catch_statement_without_exception_reference() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } catch (InvalidOperationException) { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } """); @@ -1852,23 +1880,29 @@ public void Try_fault_statement() """ try { - LinqToCSharpTranslatorTest.Foo(); + LinqToCSharpSyntaxTranslatorTest.Foo(); } catch { - LinqToCSharpTranslatorTest.Bar(); + LinqToCSharpSyntaxTranslatorTest.Bar(); } """); // TODO: try/catch expressions - private void AssertStatement(Expression expression, string expected) - => AssertCore(expression, isStatement: true, expected); + private void AssertStatement(Expression expression, string expected, + Dictionary? constantReplacements = null, + Dictionary? memberAccessReplacements = null) + => AssertCore(expression, isStatement: true, expected, constantReplacements, memberAccessReplacements); - private void AssertExpression(Expression expression, string expected) - => AssertCore(expression, isStatement: false, expected); + private void AssertExpression(Expression expression, string expected, + Dictionary? constantReplacements = null, + Dictionary? memberAccessReplacements = null) + => AssertCore(expression, isStatement: false, expected, constantReplacements, memberAccessReplacements); - private void AssertCore(Expression expression, bool isStatement, string expected) + private void AssertCore(Expression expression, bool isStatement, string expected, + Dictionary? constantReplacements, + Dictionary? memberAccessReplacements) { var typeMappingSource = new SqlServerTypeMappingSource( TestServiceFactory.Instance.Create(), @@ -1877,8 +1911,8 @@ private void AssertCore(Expression expression, bool isStatement, string expected var translator = new CSharpHelper(typeMappingSource); var namespaces = new HashSet(); var actual = isStatement - ? translator.Statement(expression, namespaces) - : translator.Expression(expression, namespaces); + ? translator.Statement(expression, constantReplacements, memberAccessReplacements, namespaces) + : translator.Expression(expression, constantReplacements, memberAccessReplacements, namespaces); if (_outputExpressionTrees) { @@ -1922,37 +1956,37 @@ private void AssertCore(Expression expression, bool isStatement, string expected // ReSharper disable MemberCanBePrivate.Local private static readonly MethodInfo ReturnsIntWithParamMethod - = typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(ReturnsIntWithParam))!; + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(ReturnsIntWithParam))!; public static int ReturnsIntWithParam(int i) => i + 1; private static readonly MethodInfo WithInOutRefParameterMethod - = typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(WithInOutRefParameter))!; + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(WithInOutRefParameter))!; public static void WithInOutRefParameter(in int inParam, out int outParam, ref int refParam) => outParam = 8; private static readonly MethodInfo GenericMethod - = typeof(LinqToCSharpTranslatorTest).GetMethods().Single(m => m.Name == nameof(GenericMethodImplementation)); + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethods().Single(m => m.Name == nameof(GenericMethodImplementation)); public static int GenericMethodImplementation(T t) => 0; private static readonly MethodInfo FooMethod - = typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(Foo))!; + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(Foo))!; public static int Foo() => 1; private static readonly MethodInfo BarMethod - = typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(Bar))!; + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(Bar))!; public static int Bar() => 1; private static readonly MethodInfo BazMethod - = typeof(LinqToCSharpTranslatorTest).GetMethod(nameof(Baz))!; + = typeof(LinqToCSharpSyntaxTranslatorTest).GetMethod(nameof(Baz))!; public static int Baz() => 1; @@ -1960,6 +1994,10 @@ public static int Baz() public static int MethodWithSixParams(int a, int b, int c, int d, int e, int f) => a + b + c + d + e + f; + + private static readonly FieldInfo BlogPrivateField + = typeof(Blog).GetField("_privateField", BindingFlags.NonPublic | BindingFlags.Instance)!; + private class Blog { #pragma warning disable CS0169 diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs index 45dc0207515..a24b8a3e5ed 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs @@ -3,11 +3,15 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.ValueGeneration; @@ -42,6 +46,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -57,12 +82,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var discriminator = runtimeEntityType.AddProperty( "Discriminator", typeof(string), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -85,6 +117,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AnEnum)0); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum1.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -107,6 +160,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum2.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -129,6 +203,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum1.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -151,6 +246,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum2.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -171,6 +287,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "PrincipalBaseId", typeof(long?), nullable: true); + principalBaseId.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -186,6 +308,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); var refTypeArray = runtimeEntityType.AddProperty( "RefTypeArray", @@ -193,6 +316,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -246,6 +390,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -285,6 +450,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -324,6 +510,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -377,6 +584,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -416,6 +644,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -455,6 +704,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -494,6 +764,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -538,7 +829,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas return runtimeEntityType; } - private static class OwnedComplexProperty + public static class OwnedComplexProperty { public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) { @@ -554,6 +845,27 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) complexPropertyCount: 1); var complexType = complexProperty.ComplexType; + complexProperty.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadOwned(instance) == null); + complexProperty.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => WriteOwned(entity, value)); + complexProperty.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => WriteOwned(entity, value)); + complexProperty.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(complexProperty), + null); + complexProperty.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); var details = complexType.AddProperty( "Details", typeof(string), @@ -570,6 +882,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) precision: 3, scale: 2, sentinel: ""); + details.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details, + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details) == null) && (ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details) == "", + (CompiledModelTestBase.OwnedType instance) => instance.Details, + (CompiledModelTestBase.OwnedType instance) => !(instance.Details == null) && instance.Details == ""); + details.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, string value) => + { + var level1 = ReadOwned(entity); + level1.Details = value; + }); + details.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, string value) => + { + var level1 = ReadOwned(entity); + level1.Details = value; + }); + details.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(15) ? entry.ReadStoreGeneratedValue(2) : entry.FlaggedAsTemporary(15) && !((ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details) == null) && (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details) == "" ? entry.ReadTemporaryValue(2) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details, + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details, + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[15]); + details.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 2); details.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -593,6 +934,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(int) : ReadNumber(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(int) : ReadNumber(ReadOwned(entity))) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, int value) => + { + var level1 = ReadOwned(entity); + WriteNumber(level1, value); + }); + number.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, int value) => + { + var level1 = ReadOwned(entity); + WriteNumber(level1, value); + }); + number.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(int) : ReadNumber(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(int) : ReadNumber(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[16]); + number.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -615,6 +985,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeArray(level1, value); + }); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeArray(level1, value); + }); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + refTypeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -668,6 +1067,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeEnumerable(level1, value); + }); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeEnumerable(level1, value); + }); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[18]); + refTypeEnumerable.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -707,6 +1135,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeIList(level1, value); + }); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeIList(level1, value); + }); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[19]); + refTypeIList.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -746,6 +1203,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(List) : ReadRefTypeList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(List) : ReadRefTypeList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeList(level1, value); + }); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeList(level1, value); + }); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[20]); + refTypeList.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -799,6 +1285,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeArray(level1, value); + }); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeArray(level1, value); + }); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[21]); + valueTypeArray.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -838,6 +1353,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeEnumerable(level1, value); + }); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeEnumerable(level1, value); + }); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[22]); + valueTypeEnumerable.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -877,6 +1421,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeIList(level1, value); + }); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeIList(level1, value); + }); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[23]); + valueTypeIList.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -916,6 +1489,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(List) : ReadValueTypeList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(List) : ReadValueTypeList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeList(level1, value); + }); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeList(level1, value); + }); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[24]); + valueTypeList.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -955,7 +1557,7 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) return complexProperty; } - private static class PrincipalComplexProperty + public static class PrincipalComplexProperty { public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) { @@ -968,11 +1570,71 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyCount: 14); var complexType = complexProperty.ComplexType; + complexProperty.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadPrincipal(instance), + (CompiledModelTestBase.OwnedType instance) => ReadPrincipal(instance) == null); + complexProperty.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.PrincipalBase value) => + { + var level1 = ReadOwned(entity); + WritePrincipal(level1, value); + }); + complexProperty.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.PrincipalBase value) => + { + var level1 = ReadOwned(entity); + WritePrincipal(level1, value); + }); + complexProperty.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(complexProperty), + null); + complexProperty.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); var alternateId = complexType.AddProperty( "AlternateId", typeof(Guid), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("AlternateId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Guid) : (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))).AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Guid) : (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))).AlternateId) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + level2.AlternateId = value; + }); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + level2.AlternateId = value; + }); + alternateId.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Guid) : (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))).AlternateId, + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Guid) : (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(alternateId), + (ValueBuffer valueBuffer) => valueBuffer[25]); + alternateId.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); alternateId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -995,6 +1657,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AnEnum)0); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum1(level2, value); + }); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum1(level2, value); + }); + enum1.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[26]); + enum1.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -1017,6 +1710,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum2(level2, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value); + }); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum2(level2, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value); + }); + enum2.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[27]); + enum2.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -1039,6 +1763,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum1(level2, value); + }); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum1(level2, value); + }); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[28]); + flagsEnum1.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -1061,6 +1816,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum2(level2, value); + }); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum2(level2, value); + }); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[29]); + flagsEnum2.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -1083,6 +1869,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadId(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadId(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteId(level2, value); + }); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteId(level2, value); + }); + id.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadId(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadId(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[30]); + id.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -1105,6 +1922,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeArray(level2, value); + }); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeArray(level2, value); + }); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[31]); + refTypeArray.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -1158,6 +2006,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeEnumerable(level2, value); + }); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeEnumerable(level2, value); + }); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[32]); + refTypeEnumerable.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -1197,6 +2076,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeIList(level2, value); + }); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeIList(level2, value); + }); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[33]); + refTypeIList.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -1236,6 +2146,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadRefTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadRefTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeList(level2, value); + }); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeList(level2, value); + }); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[34]); + refTypeList.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -1289,6 +2230,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeArray(level2, value); + }); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeArray(level2, value); + }); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + valueTypeArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -1328,6 +2300,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeEnumerable(level2, value); + }); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeEnumerable(level2, value); + }); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[36]); + valueTypeEnumerable.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1367,6 +2370,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeIList(level2, value); + }); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeIList(level2, value); + }); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[37]); + valueTypeIList.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1406,6 +2440,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadValueTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadValueTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeList(level2, value); + }); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeList(level2, value); + }); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[38]); + valueTypeList.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -1441,7 +2506,232 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) return complexProperty; } + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalBase GetPrincipal(CompiledModelTestBase.OwnedType @this); + + public static CompiledModelTestBase.PrincipalBase ReadPrincipal(CompiledModelTestBase.OwnedType @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.OwnedType @this, CompiledModelTestBase.PrincipalBase value) + => GetPrincipal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; } + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) @@ -1457,15 +2747,242 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + deriveds.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance) == null); + deriveds.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(deriveds), + null); + deriveds.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); + deriveds.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindComplexProperty("Owned")!; + var ownedType = owned.ComplexType; + var details = ownedType.FindProperty("Details")!; + var number = ownedType.FindProperty("Number")!; + var refTypeArray0 = ownedType.FindProperty("RefTypeArray")!; + var refTypeEnumerable0 = ownedType.FindProperty("RefTypeEnumerable")!; + var refTypeIList0 = ownedType.FindProperty("RefTypeIList")!; + var refTypeList0 = ownedType.FindProperty("RefTypeList")!; + var valueTypeArray0 = ownedType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable0 = ownedType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList0 = ownedType.FindProperty("ValueTypeIList")!; + var valueTypeList0 = ownedType.FindProperty("ValueTypeList")!; + var principal = ownedType.FindComplexProperty("Principal")!; + var principalBase = principal.ComplexType; + var alternateId = principalBase.FindProperty("AlternateId")!; + var enum10 = principalBase.FindProperty("Enum1")!; + var enum20 = principalBase.FindProperty("Enum2")!; + var flagsEnum10 = principalBase.FindProperty("FlagsEnum1")!; + var flagsEnum20 = principalBase.FindProperty("FlagsEnum2")!; + var id0 = principalBase.FindProperty("Id")!; + var refTypeArray1 = principalBase.FindProperty("RefTypeArray")!; + var refTypeEnumerable1 = principalBase.FindProperty("RefTypeEnumerable")!; + var refTypeIList1 = principalBase.FindProperty("RefTypeIList")!; + var refTypeList1 = principalBase.FindProperty("RefTypeList")!; + var valueTypeArray1 = principalBase.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable1 = principalBase.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList1 = principalBase.FindProperty("ValueTypeIList")!; + var valueTypeList1 = principalBase.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + var liftedArg = (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, string, int, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray0) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray0)), source.GetCurrentValue>(refTypeEnumerable0) == null ? null : ((ValueComparer>)refTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(refTypeIList0) == null ? null : (IList)((ValueComparer>)refTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList0)), (IEnumerable)source.GetCurrentValue>(refTypeList0) == null ? null : (List)((ValueComparer>)refTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList0)), (IEnumerable)source.GetCurrentValue(valueTypeArray0) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray0)), source.GetCurrentValue>(valueTypeEnumerable0) == null ? null : ((ValueComparer>)valueTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(valueTypeIList0) == null ? null : (IList)((ValueComparer>)valueTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList0)), (IEnumerable)source.GetCurrentValue>(valueTypeList0) == null ? null : (List)((ValueComparer>)valueTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList0)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum10.GetValueComparer()).Snapshot(source.GetCurrentValue(enum10)), source.GetCurrentValue>(enum20) == null ? null : ((ValueComparer>)enum20.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum20)), ((ValueComparer)flagsEnum10.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum10)), ((ValueComparer)flagsEnum20.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum20))); + var entity0 = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, (ISnapshot)new Snapshot, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id0) == null ? null : ((ValueComparer>)id0.GetValueComparer()).Snapshot(source.GetCurrentValue>(id0)), (IEnumerable)source.GetCurrentValue(refTypeArray1) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray1)), source.GetCurrentValue>(refTypeEnumerable1) == null ? null : ((ValueComparer>)refTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(refTypeIList1) == null ? null : (IList)((ValueComparer>)refTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList1)), (IEnumerable)source.GetCurrentValue>(refTypeList1) == null ? null : (List)((ValueComparer>)refTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList1)), (IEnumerable)source.GetCurrentValue(valueTypeArray1) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray1)), source.GetCurrentValue>(valueTypeEnumerable1) == null ? null : ((ValueComparer>)valueTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(valueTypeIList1) == null ? null : (IList)((ValueComparer>)valueTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList1)), (IEnumerable)source.GetCurrentValue>(valueTypeList1) == null ? null : (List)((ValueComparer>)valueTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList1))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(string) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(default(string)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable), default(Nullable), default(string))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(string), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), SnapshotFactoryFactory.SnapshotCollection(ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 39, + navigationCount: 1, + complexPropertyCount: 2, + originalValueCount: 39, + shadowCount: 2, + relationshipCount: 3, + storeGeneratedCount: 3); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs index 222d7826faf..d1a42d3dd2e 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs @@ -1,7 +1,12 @@ // using System; +using System.Collections.Generic; +using System.Net; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -26,6 +31,80 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindComplexProperty("Owned")!; + var ownedType = owned.ComplexType; + var details = ownedType.FindProperty("Details")!; + var number = ownedType.FindProperty("Number")!; + var refTypeArray0 = ownedType.FindProperty("RefTypeArray")!; + var refTypeEnumerable0 = ownedType.FindProperty("RefTypeEnumerable")!; + var refTypeIList0 = ownedType.FindProperty("RefTypeIList")!; + var refTypeList0 = ownedType.FindProperty("RefTypeList")!; + var valueTypeArray0 = ownedType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable0 = ownedType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList0 = ownedType.FindProperty("ValueTypeIList")!; + var valueTypeList0 = ownedType.FindProperty("ValueTypeList")!; + var principal = ownedType.FindComplexProperty("Principal")!; + var principalBase = principal.ComplexType; + var alternateId = principalBase.FindProperty("AlternateId")!; + var enum10 = principalBase.FindProperty("Enum1")!; + var enum20 = principalBase.FindProperty("Enum2")!; + var flagsEnum10 = principalBase.FindProperty("FlagsEnum1")!; + var flagsEnum20 = principalBase.FindProperty("FlagsEnum2")!; + var id0 = principalBase.FindProperty("Id")!; + var refTypeArray1 = principalBase.FindProperty("RefTypeArray")!; + var refTypeEnumerable1 = principalBase.FindProperty("RefTypeEnumerable")!; + var refTypeIList1 = principalBase.FindProperty("RefTypeIList")!; + var refTypeList1 = principalBase.FindProperty("RefTypeList")!; + var valueTypeArray1 = principalBase.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable1 = principalBase.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList1 = principalBase.FindProperty("ValueTypeIList")!; + var valueTypeList1 = principalBase.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity1 = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, string, int, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray0) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray0)), source.GetCurrentValue>(refTypeEnumerable0) == null ? null : ((ValueComparer>)refTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(refTypeIList0) == null ? null : (IList)((ValueComparer>)refTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList0)), (IEnumerable)source.GetCurrentValue>(refTypeList0) == null ? null : (List)((ValueComparer>)refTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList0)), (IEnumerable)source.GetCurrentValue(valueTypeArray0) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray0)), source.GetCurrentValue>(valueTypeEnumerable0) == null ? null : ((ValueComparer>)valueTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(valueTypeIList0) == null ? null : (IList)((ValueComparer>)valueTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList0)), (IEnumerable)source.GetCurrentValue>(valueTypeList0) == null ? null : (List)((ValueComparer>)valueTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList0)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum10.GetValueComparer()).Snapshot(source.GetCurrentValue(enum10)), source.GetCurrentValue>(enum20) == null ? null : ((ValueComparer>)enum20.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum20)), ((ValueComparer)flagsEnum10.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum10)), ((ValueComparer)flagsEnum20.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum20))); + var entity2 = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg0, (ISnapshot)new Snapshot, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id0) == null ? null : ((ValueComparer>)id0.GetValueComparer()).Snapshot(source.GetCurrentValue>(id0)), (IEnumerable)source.GetCurrentValue(refTypeArray1) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray1)), source.GetCurrentValue>(refTypeEnumerable1) == null ? null : ((ValueComparer>)refTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(refTypeIList1) == null ? null : (IList)((ValueComparer>)refTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList1)), (IEnumerable)source.GetCurrentValue>(refTypeList1) == null ? null : (List)((ValueComparer>)refTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList1)), (IEnumerable)source.GetCurrentValue(valueTypeArray1) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray1)), source.GetCurrentValue>(valueTypeEnumerable1) == null ? null : ((ValueComparer>)valueTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(valueTypeIList1) == null ? null : (IList)((ValueComparer>)valueTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList1)), (IEnumerable)source.GetCurrentValue>(valueTypeList1) == null ? null : (List)((ValueComparer>)valueTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList1))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(string) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(default(string)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable), default(Nullable), default(string))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(string), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), SnapshotFactoryFactory.SnapshotCollection(PrincipalBaseEntityType.ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 39, + navigationCount: 1, + complexPropertyCount: 2, + originalValueCount: 39, + shadowCount: 2, + relationshipCount: 3, + storeGeneratedCount: 3); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_provider_value_comparer/MyEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_provider_value_comparer/MyEntityEntityType.cs index 27153ce987e..230096aaa35 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_provider_value_comparer/MyEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_provider_value_comparer/MyEntityEntityType.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -33,6 +36,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, providerPropertyType: typeof(int)); + id.SetGetter( + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null ? 0 : (int)(entity.ContainsKey("Id") ? entity["Id"] : null), + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null ? 0 : (int)(instance.ContainsKey("Id") ? instance["Id"] : null), + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null); + id.SetSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetMaterializationSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -48,6 +96,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => 1), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -58,6 +107,35 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_type_mapping/MyEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_type_mapping/MyEntityEntityType.cs index c758d9a9086..edc1a6aaffb 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_type_mapping/MyEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_type_mapping/MyEntityEntityType.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -32,6 +35,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null ? 0 : (int)(entity.ContainsKey("Id") ? entity["Id"] : null), + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null ? 0 : (int)(instance.ContainsKey("Id") ? instance["Id"] : null), + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null); + id.SetSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetMaterializationSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -47,6 +95,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -57,6 +106,35 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_comparer/MyEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_comparer/MyEntityEntityType.cs index 5d1bb51bd0e..dc37dda0e68 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_comparer/MyEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_comparer/MyEntityEntityType.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -33,6 +36,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, providerPropertyType: typeof(int)); + id.SetGetter( + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null ? 0 : (int)(entity.ContainsKey("Id") ? entity["Id"] : null), + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null ? 0 : (int)(instance.ContainsKey("Id") ? instance["Id"] : null), + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null); + id.SetSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetMaterializationSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int l, int r) => false, @@ -48,6 +96,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => 1), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -58,6 +107,35 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_converter/MyEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_converter/MyEntityEntityType.cs index 2b1abeb199d..5044d1c341e 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_converter/MyEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_converter/MyEntityEntityType.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -33,6 +36,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null ? 0 : (int)(entity.ContainsKey("Id") ? entity["Id"] : null), + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null ? 0 : (int)(instance.ContainsKey("Id") ? instance["Id"] : null), + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null); + id.SetSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetMaterializationSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -54,6 +102,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (int i) => i, (int i) => i))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -64,6 +113,35 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUser0EntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUser0EntityType.cs index d5820033a22..37a51842c50 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUser0EntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUser0EntityType.cs @@ -1,7 +1,11 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -26,6 +30,50 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var accessFailedCount = runtimeEntityType.FindProperty("AccessFailedCount")!; + var concurrencyStamp = runtimeEntityType.FindProperty("ConcurrencyStamp")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var email = runtimeEntityType.FindProperty("Email")!; + var emailConfirmed = runtimeEntityType.FindProperty("EmailConfirmed")!; + var lockoutEnabled = runtimeEntityType.FindProperty("LockoutEnabled")!; + var lockoutEnd = runtimeEntityType.FindProperty("LockoutEnd")!; + var normalizedEmail = runtimeEntityType.FindProperty("NormalizedEmail")!; + var normalizedUserName = runtimeEntityType.FindProperty("NormalizedUserName")!; + var passwordHash = runtimeEntityType.FindProperty("PasswordHash")!; + var phoneNumber = runtimeEntityType.FindProperty("PhoneNumber")!; + var phoneNumberConfirmed = runtimeEntityType.FindProperty("PhoneNumberConfirmed")!; + var securityStamp = runtimeEntityType.FindProperty("SecurityStamp")!; + var twoFactorEnabled = runtimeEntityType.FindProperty("TwoFactorEnabled")!; + var userName = runtimeEntityType.FindProperty("UserName")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.IdentityUser)source.Entity; + return (ISnapshot)new Snapshot, string, string, string, string, bool, string, bool, string>(source.GetCurrentValue(id) == null ? null : ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)accessFailedCount.GetValueComparer()).Snapshot(source.GetCurrentValue(accessFailedCount)), source.GetCurrentValue(concurrencyStamp) == null ? null : ((ValueComparer)concurrencyStamp.GetValueComparer()).Snapshot(source.GetCurrentValue(concurrencyStamp)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), source.GetCurrentValue(email) == null ? null : ((ValueComparer)email.GetValueComparer()).Snapshot(source.GetCurrentValue(email)), ((ValueComparer)emailConfirmed.GetValueComparer()).Snapshot(source.GetCurrentValue(emailConfirmed)), ((ValueComparer)lockoutEnabled.GetValueComparer()).Snapshot(source.GetCurrentValue(lockoutEnabled)), source.GetCurrentValue>(lockoutEnd) == null ? null : ((ValueComparer>)lockoutEnd.GetValueComparer()).Snapshot(source.GetCurrentValue>(lockoutEnd)), source.GetCurrentValue(normalizedEmail) == null ? null : ((ValueComparer)normalizedEmail.GetValueComparer()).Snapshot(source.GetCurrentValue(normalizedEmail)), source.GetCurrentValue(normalizedUserName) == null ? null : ((ValueComparer)normalizedUserName.GetValueComparer()).Snapshot(source.GetCurrentValue(normalizedUserName)), source.GetCurrentValue(passwordHash) == null ? null : ((ValueComparer)passwordHash.GetValueComparer()).Snapshot(source.GetCurrentValue(passwordHash)), source.GetCurrentValue(phoneNumber) == null ? null : ((ValueComparer)phoneNumber.GetValueComparer()).Snapshot(source.GetCurrentValue(phoneNumber)), ((ValueComparer)phoneNumberConfirmed.GetValueComparer()).Snapshot(source.GetCurrentValue(phoneNumberConfirmed)), source.GetCurrentValue(securityStamp) == null ? null : ((ValueComparer)securityStamp.GetValueComparer()).Snapshot(source.GetCurrentValue(securityStamp)), ((ValueComparer)twoFactorEnabled.GetValueComparer()).Snapshot(source.GetCurrentValue(twoFactorEnabled)), source.GetCurrentValue(userName) == null ? null : ((ValueComparer)userName.GetValueComparer()).Snapshot(source.GetCurrentValue(userName))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.IdentityUser)source.Entity; + return (ISnapshot)new Snapshot(source.GetCurrentValue(id) == null ? null : ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 16, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 16, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 0); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUserEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUserEntityType.cs index 0e1a2df6e8d..779dbbb2c9d 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUserEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IdentityUserEntityType.cs @@ -1,9 +1,14 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.TestModels.AspNetIdentity; using Microsoft.EntityFrameworkCore.ValueGeneration; @@ -33,6 +38,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (IdentityUser entity) => ReadId(entity), + (IdentityUser entity) => ReadId(entity) == null, + (IdentityUser instance) => ReadId(instance), + (IdentityUser instance) => ReadId(instance) == null); + id.SetSetter( + (IdentityUser entity, string value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadId((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -48,6 +74,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v), clrType: typeof(string), jsonValueReaderWriter: JsonStringReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var accessFailedCount = runtimeEntityType.AddProperty( "AccessFailedCount", @@ -55,6 +82,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("AccessFailedCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + accessFailedCount.SetGetter( + (IdentityUser entity) => ReadAccessFailedCount(entity), + (IdentityUser entity) => ReadAccessFailedCount(entity) == 0, + (IdentityUser instance) => ReadAccessFailedCount(instance), + (IdentityUser instance) => ReadAccessFailedCount(instance) == 0); + accessFailedCount.SetSetter( + (IdentityUser entity, int value) => WriteAccessFailedCount(entity, value)); + accessFailedCount.SetMaterializationSetter( + (IdentityUser entity, int value) => WriteAccessFailedCount(entity, value)); + accessFailedCount.SetAccessors( + (InternalEntityEntry entry) => ReadAccessFailedCount((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadAccessFailedCount((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(accessFailedCount, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(accessFailedCount), + (ValueBuffer valueBuffer) => valueBuffer[1]); + accessFailedCount.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); accessFailedCount.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -77,6 +125,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("ConcurrencyStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + concurrencyStamp.SetGetter( + (IdentityUser entity) => ReadConcurrencyStamp(entity), + (IdentityUser entity) => ReadConcurrencyStamp(entity) == null, + (IdentityUser instance) => ReadConcurrencyStamp(instance), + (IdentityUser instance) => ReadConcurrencyStamp(instance) == null); + concurrencyStamp.SetSetter( + (IdentityUser entity, string value) => WriteConcurrencyStamp(entity, value)); + concurrencyStamp.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteConcurrencyStamp(entity, value)); + concurrencyStamp.SetAccessors( + (InternalEntityEntry entry) => ReadConcurrencyStamp((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadConcurrencyStamp((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(concurrencyStamp, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(concurrencyStamp), + (ValueBuffer valueBuffer) => valueBuffer[2]); + concurrencyStamp.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); concurrencyStamp.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -98,6 +167,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -120,6 +195,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + email.SetGetter( + (IdentityUser entity) => ReadEmail(entity), + (IdentityUser entity) => ReadEmail(entity) == null, + (IdentityUser instance) => ReadEmail(instance), + (IdentityUser instance) => ReadEmail(instance) == null); + email.SetSetter( + (IdentityUser entity, string value) => WriteEmail(entity, value)); + email.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteEmail(entity, value)); + email.SetAccessors( + (InternalEntityEntry entry) => ReadEmail((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadEmail((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(email, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(email), + (ValueBuffer valueBuffer) => valueBuffer[4]); + email.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); email.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -142,6 +238,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("EmailConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + emailConfirmed.SetGetter( + (IdentityUser entity) => ReadEmailConfirmed(entity), + (IdentityUser entity) => ReadEmailConfirmed(entity) == false, + (IdentityUser instance) => ReadEmailConfirmed(instance), + (IdentityUser instance) => ReadEmailConfirmed(instance) == false); + emailConfirmed.SetSetter( + (IdentityUser entity, bool value) => WriteEmailConfirmed(entity, value)); + emailConfirmed.SetMaterializationSetter( + (IdentityUser entity, bool value) => WriteEmailConfirmed(entity, value)); + emailConfirmed.SetAccessors( + (InternalEntityEntry entry) => ReadEmailConfirmed((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadEmailConfirmed((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(emailConfirmed, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(emailConfirmed), + (ValueBuffer valueBuffer) => valueBuffer[5]); + emailConfirmed.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); emailConfirmed.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -164,6 +281,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + lockoutEnabled.SetGetter( + (IdentityUser entity) => ReadLockoutEnabled(entity), + (IdentityUser entity) => ReadLockoutEnabled(entity) == false, + (IdentityUser instance) => ReadLockoutEnabled(instance), + (IdentityUser instance) => ReadLockoutEnabled(instance) == false); + lockoutEnabled.SetSetter( + (IdentityUser entity, bool value) => WriteLockoutEnabled(entity, value)); + lockoutEnabled.SetMaterializationSetter( + (IdentityUser entity, bool value) => WriteLockoutEnabled(entity, value)); + lockoutEnabled.SetAccessors( + (InternalEntityEntry entry) => ReadLockoutEnabled((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadLockoutEnabled((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(lockoutEnabled, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(lockoutEnabled), + (ValueBuffer valueBuffer) => valueBuffer[6]); + lockoutEnabled.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); lockoutEnabled.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -186,6 +324,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("LockoutEnd", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + lockoutEnd.SetGetter( + (IdentityUser entity) => ReadLockoutEnd(entity), + (IdentityUser entity) => !ReadLockoutEnd(entity).HasValue, + (IdentityUser instance) => ReadLockoutEnd(instance), + (IdentityUser instance) => !ReadLockoutEnd(instance).HasValue); + lockoutEnd.SetSetter( + (IdentityUser entity, Nullable value) => WriteLockoutEnd(entity, value)); + lockoutEnd.SetMaterializationSetter( + (IdentityUser entity, Nullable value) => WriteLockoutEnd(entity, value)); + lockoutEnd.SetAccessors( + (InternalEntityEntry entry) => ReadLockoutEnd((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadLockoutEnd((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(lockoutEnd, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(lockoutEnd), + (ValueBuffer valueBuffer) => valueBuffer[7]); + lockoutEnd.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); lockoutEnd.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((DateTimeOffset)v1).EqualsExact((DateTimeOffset)v2) || !v1.HasValue && !v2.HasValue, @@ -208,6 +367,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("NormalizedEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + normalizedEmail.SetGetter( + (IdentityUser entity) => ReadNormalizedEmail(entity), + (IdentityUser entity) => ReadNormalizedEmail(entity) == null, + (IdentityUser instance) => ReadNormalizedEmail(instance), + (IdentityUser instance) => ReadNormalizedEmail(instance) == null); + normalizedEmail.SetSetter( + (IdentityUser entity, string value) => WriteNormalizedEmail(entity, value)); + normalizedEmail.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteNormalizedEmail(entity, value)); + normalizedEmail.SetAccessors( + (InternalEntityEntry entry) => ReadNormalizedEmail((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadNormalizedEmail((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(normalizedEmail, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(normalizedEmail), + (ValueBuffer valueBuffer) => valueBuffer[8]); + normalizedEmail.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); normalizedEmail.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -230,6 +410,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("NormalizedUserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + normalizedUserName.SetGetter( + (IdentityUser entity) => ReadNormalizedUserName(entity), + (IdentityUser entity) => ReadNormalizedUserName(entity) == null, + (IdentityUser instance) => ReadNormalizedUserName(instance), + (IdentityUser instance) => ReadNormalizedUserName(instance) == null); + normalizedUserName.SetSetter( + (IdentityUser entity, string value) => WriteNormalizedUserName(entity, value)); + normalizedUserName.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteNormalizedUserName(entity, value)); + normalizedUserName.SetAccessors( + (InternalEntityEntry entry) => ReadNormalizedUserName((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadNormalizedUserName((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(normalizedUserName, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(normalizedUserName), + (ValueBuffer valueBuffer) => valueBuffer[9]); + normalizedUserName.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); normalizedUserName.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -252,6 +453,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PasswordHash", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + passwordHash.SetGetter( + (IdentityUser entity) => ReadPasswordHash(entity), + (IdentityUser entity) => ReadPasswordHash(entity) == null, + (IdentityUser instance) => ReadPasswordHash(instance), + (IdentityUser instance) => ReadPasswordHash(instance) == null); + passwordHash.SetSetter( + (IdentityUser entity, string value) => WritePasswordHash(entity, value)); + passwordHash.SetMaterializationSetter( + (IdentityUser entity, string value) => WritePasswordHash(entity, value)); + passwordHash.SetAccessors( + (InternalEntityEntry entry) => ReadPasswordHash((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadPasswordHash((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(passwordHash, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(passwordHash), + (ValueBuffer valueBuffer) => valueBuffer[10]); + passwordHash.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); passwordHash.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -274,6 +496,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + phoneNumber.SetGetter( + (IdentityUser entity) => ReadPhoneNumber(entity), + (IdentityUser entity) => ReadPhoneNumber(entity) == null, + (IdentityUser instance) => ReadPhoneNumber(instance), + (IdentityUser instance) => ReadPhoneNumber(instance) == null); + phoneNumber.SetSetter( + (IdentityUser entity, string value) => WritePhoneNumber(entity, value)); + phoneNumber.SetMaterializationSetter( + (IdentityUser entity, string value) => WritePhoneNumber(entity, value)); + phoneNumber.SetAccessors( + (InternalEntityEntry entry) => ReadPhoneNumber((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadPhoneNumber((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(phoneNumber, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(phoneNumber), + (ValueBuffer valueBuffer) => valueBuffer[11]); + phoneNumber.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); phoneNumber.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -296,6 +539,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("PhoneNumberConfirmed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + phoneNumberConfirmed.SetGetter( + (IdentityUser entity) => ReadPhoneNumberConfirmed(entity), + (IdentityUser entity) => ReadPhoneNumberConfirmed(entity) == false, + (IdentityUser instance) => ReadPhoneNumberConfirmed(instance), + (IdentityUser instance) => ReadPhoneNumberConfirmed(instance) == false); + phoneNumberConfirmed.SetSetter( + (IdentityUser entity, bool value) => WritePhoneNumberConfirmed(entity, value)); + phoneNumberConfirmed.SetMaterializationSetter( + (IdentityUser entity, bool value) => WritePhoneNumberConfirmed(entity, value)); + phoneNumberConfirmed.SetAccessors( + (InternalEntityEntry entry) => ReadPhoneNumberConfirmed((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadPhoneNumberConfirmed((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(phoneNumberConfirmed, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(phoneNumberConfirmed), + (ValueBuffer valueBuffer) => valueBuffer[12]); + phoneNumberConfirmed.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); phoneNumberConfirmed.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -318,6 +582,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("SecurityStamp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + securityStamp.SetGetter( + (IdentityUser entity) => ReadSecurityStamp(entity), + (IdentityUser entity) => ReadSecurityStamp(entity) == null, + (IdentityUser instance) => ReadSecurityStamp(instance), + (IdentityUser instance) => ReadSecurityStamp(instance) == null); + securityStamp.SetSetter( + (IdentityUser entity, string value) => WriteSecurityStamp(entity, value)); + securityStamp.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteSecurityStamp(entity, value)); + securityStamp.SetAccessors( + (InternalEntityEntry entry) => ReadSecurityStamp((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadSecurityStamp((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(securityStamp, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue(securityStamp), + (ValueBuffer valueBuffer) => valueBuffer[13]); + securityStamp.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); securityStamp.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -340,6 +625,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("TwoFactorEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + twoFactorEnabled.SetGetter( + (IdentityUser entity) => ReadTwoFactorEnabled(entity), + (IdentityUser entity) => ReadTwoFactorEnabled(entity) == false, + (IdentityUser instance) => ReadTwoFactorEnabled(instance), + (IdentityUser instance) => ReadTwoFactorEnabled(instance) == false); + twoFactorEnabled.SetSetter( + (IdentityUser entity, bool value) => WriteTwoFactorEnabled(entity, value)); + twoFactorEnabled.SetMaterializationSetter( + (IdentityUser entity, bool value) => WriteTwoFactorEnabled(entity, value)); + twoFactorEnabled.SetAccessors( + (InternalEntityEntry entry) => ReadTwoFactorEnabled((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadTwoFactorEnabled((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(twoFactorEnabled, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue(twoFactorEnabled), + (ValueBuffer valueBuffer) => valueBuffer[14]); + twoFactorEnabled.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); twoFactorEnabled.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -362,6 +668,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(IdentityUser).GetProperty("UserName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(IdentityUser).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + userName.SetGetter( + (IdentityUser entity) => ReadUserName(entity), + (IdentityUser entity) => ReadUserName(entity) == null, + (IdentityUser instance) => ReadUserName(instance), + (IdentityUser instance) => ReadUserName(instance) == null); + userName.SetSetter( + (IdentityUser entity, string value) => WriteUserName(entity, value)); + userName.SetMaterializationSetter( + (IdentityUser entity, string value) => WriteUserName(entity, value)); + userName.SetAccessors( + (InternalEntityEntry entry) => ReadUserName((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => ReadUserName((IdentityUser)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(userName, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(userName), + (ValueBuffer valueBuffer) => valueBuffer[15]); + userName.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); userName.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -387,10 +714,189 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var accessFailedCount = runtimeEntityType.FindProperty("AccessFailedCount")!; + var concurrencyStamp = runtimeEntityType.FindProperty("ConcurrencyStamp")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var email = runtimeEntityType.FindProperty("Email")!; + var emailConfirmed = runtimeEntityType.FindProperty("EmailConfirmed")!; + var lockoutEnabled = runtimeEntityType.FindProperty("LockoutEnabled")!; + var lockoutEnd = runtimeEntityType.FindProperty("LockoutEnd")!; + var normalizedEmail = runtimeEntityType.FindProperty("NormalizedEmail")!; + var normalizedUserName = runtimeEntityType.FindProperty("NormalizedUserName")!; + var passwordHash = runtimeEntityType.FindProperty("PasswordHash")!; + var phoneNumber = runtimeEntityType.FindProperty("PhoneNumber")!; + var phoneNumberConfirmed = runtimeEntityType.FindProperty("PhoneNumberConfirmed")!; + var securityStamp = runtimeEntityType.FindProperty("SecurityStamp")!; + var twoFactorEnabled = runtimeEntityType.FindProperty("TwoFactorEnabled")!; + var userName = runtimeEntityType.FindProperty("UserName")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (IdentityUser)source.Entity; + return (ISnapshot)new Snapshot, string, string, string, string, bool, string, bool, string>(source.GetCurrentValue(id) == null ? null : ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)accessFailedCount.GetValueComparer()).Snapshot(source.GetCurrentValue(accessFailedCount)), source.GetCurrentValue(concurrencyStamp) == null ? null : ((ValueComparer)concurrencyStamp.GetValueComparer()).Snapshot(source.GetCurrentValue(concurrencyStamp)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), source.GetCurrentValue(email) == null ? null : ((ValueComparer)email.GetValueComparer()).Snapshot(source.GetCurrentValue(email)), ((ValueComparer)emailConfirmed.GetValueComparer()).Snapshot(source.GetCurrentValue(emailConfirmed)), ((ValueComparer)lockoutEnabled.GetValueComparer()).Snapshot(source.GetCurrentValue(lockoutEnabled)), source.GetCurrentValue>(lockoutEnd) == null ? null : ((ValueComparer>)lockoutEnd.GetValueComparer()).Snapshot(source.GetCurrentValue>(lockoutEnd)), source.GetCurrentValue(normalizedEmail) == null ? null : ((ValueComparer)normalizedEmail.GetValueComparer()).Snapshot(source.GetCurrentValue(normalizedEmail)), source.GetCurrentValue(normalizedUserName) == null ? null : ((ValueComparer)normalizedUserName.GetValueComparer()).Snapshot(source.GetCurrentValue(normalizedUserName)), source.GetCurrentValue(passwordHash) == null ? null : ((ValueComparer)passwordHash.GetValueComparer()).Snapshot(source.GetCurrentValue(passwordHash)), source.GetCurrentValue(phoneNumber) == null ? null : ((ValueComparer)phoneNumber.GetValueComparer()).Snapshot(source.GetCurrentValue(phoneNumber)), ((ValueComparer)phoneNumberConfirmed.GetValueComparer()).Snapshot(source.GetCurrentValue(phoneNumberConfirmed)), source.GetCurrentValue(securityStamp) == null ? null : ((ValueComparer)securityStamp.GetValueComparer()).Snapshot(source.GetCurrentValue(securityStamp)), ((ValueComparer)twoFactorEnabled.GetValueComparer()).Snapshot(source.GetCurrentValue(twoFactorEnabled)), source.GetCurrentValue(userName) == null ? null : ((ValueComparer)userName.GetValueComparer()).Snapshot(source.GetCurrentValue(userName))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (IdentityUser)source.Entity; + return (ISnapshot)new Snapshot(source.GetCurrentValue(id) == null ? null : ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 16, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 16, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 0); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetId(IdentityUser @this); + + public static string ReadId(IdentityUser @this) + => GetId(@this); + + public static void WriteId(IdentityUser @this, string value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetAccessFailedCount(IdentityUser @this); + + public static int ReadAccessFailedCount(IdentityUser @this) + => GetAccessFailedCount(@this); + + public static void WriteAccessFailedCount(IdentityUser @this, int value) + => GetAccessFailedCount(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetConcurrencyStamp(IdentityUser @this); + + public static string ReadConcurrencyStamp(IdentityUser @this) + => GetConcurrencyStamp(@this); + + public static void WriteConcurrencyStamp(IdentityUser @this, string value) + => GetConcurrencyStamp(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetEmail(IdentityUser @this); + + public static string ReadEmail(IdentityUser @this) + => GetEmail(@this); + + public static void WriteEmail(IdentityUser @this, string value) + => GetEmail(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetEmailConfirmed(IdentityUser @this); + + public static bool ReadEmailConfirmed(IdentityUser @this) + => GetEmailConfirmed(@this); + + public static void WriteEmailConfirmed(IdentityUser @this, bool value) + => GetEmailConfirmed(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetLockoutEnabled(IdentityUser @this); + + public static bool ReadLockoutEnabled(IdentityUser @this) + => GetLockoutEnabled(@this); + + public static void WriteLockoutEnabled(IdentityUser @this, bool value) + => GetLockoutEnabled(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset? GetLockoutEnd(IdentityUser @this); + + public static DateTimeOffset? ReadLockoutEnd(IdentityUser @this) + => GetLockoutEnd(@this); + + public static void WriteLockoutEnd(IdentityUser @this, DateTimeOffset? value) + => GetLockoutEnd(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNormalizedEmail(IdentityUser @this); + + public static string ReadNormalizedEmail(IdentityUser @this) + => GetNormalizedEmail(@this); + + public static void WriteNormalizedEmail(IdentityUser @this, string value) + => GetNormalizedEmail(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNormalizedUserName(IdentityUser @this); + + public static string ReadNormalizedUserName(IdentityUser @this) + => GetNormalizedUserName(@this); + + public static void WriteNormalizedUserName(IdentityUser @this, string value) + => GetNormalizedUserName(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetPasswordHash(IdentityUser @this); + + public static string ReadPasswordHash(IdentityUser @this) + => GetPasswordHash(@this); + + public static void WritePasswordHash(IdentityUser @this, string value) + => GetPasswordHash(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetPhoneNumber(IdentityUser @this); + + public static string ReadPhoneNumber(IdentityUser @this) + => GetPhoneNumber(@this); + + public static void WritePhoneNumber(IdentityUser @this, string value) + => GetPhoneNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetPhoneNumberConfirmed(IdentityUser @this); + + public static bool ReadPhoneNumberConfirmed(IdentityUser @this) + => GetPhoneNumberConfirmed(@this); + + public static void WritePhoneNumberConfirmed(IdentityUser @this, bool value) + => GetPhoneNumberConfirmed(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetSecurityStamp(IdentityUser @this); + + public static string ReadSecurityStamp(IdentityUser @this) + => GetSecurityStamp(@this); + + public static void WriteSecurityStamp(IdentityUser @this, string value) + => GetSecurityStamp(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetTwoFactorEnabled(IdentityUser @this); + + public static bool ReadTwoFactorEnabled(IdentityUser @this) + => GetTwoFactorEnabled(@this); + + public static void WriteTwoFactorEnabled(IdentityUser @this, bool value) + => GetTwoFactorEnabled(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetUserName(IdentityUser @this); + + public static string ReadUserName(IdentityUser @this) + => GetUserName(@this); + + public static void WriteUserName(IdentityUser @this, string value) + => GetUserName(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IndexEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IndexEntityType.cs index edb5726a665..df2b63fae7e 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IndexEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/IndexEntityType.cs @@ -1,10 +1,15 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -31,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + id.SetGetter( + (CompiledModelInMemoryTest.Index entity) => ReadId(entity), + (CompiledModelInMemoryTest.Index entity) => ReadId(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelInMemoryTest.Index instance) => ReadId(instance), + (CompiledModelInMemoryTest.Index instance) => ReadId(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + id.SetSetter( + (CompiledModelInMemoryTest.Index entity, Guid value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.Index entity, Guid value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.Index)entry.Entity) == new Guid("00000000-0000-0000-0000-000000000000") ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.Index)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.Index)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -46,6 +72,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), clrType: typeof(Guid), jsonValueReaderWriter: JsonGuidReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -56,10 +83,48 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.Index)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.Index)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetId(CompiledModelInMemoryTest.Index @this); + + public static Guid ReadId(CompiledModelInMemoryTest.Index @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.Index @this, Guid value) + => GetId(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/ScaffoldingEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/ScaffoldingEntityType.cs index 6251173a8ca..b17627c98b8 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/ScaffoldingEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Fully_qualified_model/ScaffoldingEntityType.cs @@ -1,10 +1,15 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -31,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + id.SetGetter( + (CompiledModelInMemoryTest.Scaffolding entity) => ReadId(entity), + (CompiledModelInMemoryTest.Scaffolding entity) => ReadId(entity) == 0L, + (CompiledModelInMemoryTest.Scaffolding instance) => ReadId(instance), + (CompiledModelInMemoryTest.Scaffolding instance) => ReadId(instance) == 0L); + id.SetSetter( + (CompiledModelInMemoryTest.Scaffolding entity, long value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.Scaffolding entity, long value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.Scaffolding)entry.Entity) == 0L ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.Scaffolding)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.Scaffolding)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -46,6 +72,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -56,10 +83,48 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.Scaffolding)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(long)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.Scaffolding)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetId(CompiledModelInMemoryTest.Scaffolding @this); + + public static long ReadId(CompiledModelInMemoryTest.Scaffolding @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.Scaffolding @this, long value) + => GetId(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Global_namespace/EntityType1.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Global_namespace/EntityType1.cs index 1b226085600..027310f4ca2 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Global_namespace/EntityType1.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Global_namespace/EntityType1.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Reflection; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -30,6 +33,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null ? 0 : (int)(entity.ContainsKey("Id") ? entity["Id"] : null), + (Dictionary entity) => (entity.ContainsKey("Id") ? entity["Id"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null ? 0 : (int)(instance.ContainsKey("Id") ? instance["Id"] : null), + (Dictionary instance) => (instance.ContainsKey("Id") ? instance["Id"] : null) == null); + id.SetSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetMaterializationSetter( + (Dictionary entity, int value) => entity["Id"] = (object)value); + id.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("Id") ? ((Dictionary)entry.Entity)["Id"] : null; + return nullableValue == null ? default(int) : (int)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -45,6 +93,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -55,6 +104,35 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity1EntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity1EntityType.cs index c1df1960e8f..256e0a742bd 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity1EntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity1EntityType.cs @@ -2,13 +2,17 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Proxies.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -39,6 +43,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity) => ReadId(entity), + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity) => ReadId(entity) == 0, + (CompiledModelInMemoryTest.LazyProxiesEntity1 instance) => ReadId(instance), + (CompiledModelInMemoryTest.LazyProxiesEntity1 instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.LazyProxiesEntity1)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.LazyProxiesEntity1)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.LazyProxiesEntity1)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -54,11 +79,18 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var referenceNavigationId = runtimeEntityType.AddProperty( "ReferenceNavigationId", typeof(int?), nullable: true); + referenceNavigationId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 1); referenceNavigationId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -74,6 +106,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(int)v : default(Nullable)), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + referenceNavigationId.SetCurrentValueComparer(new EntryCurrentValueComparer(referenceNavigationId)); var lazyLoader = runtimeEntityType.AddServiceProperty( "LazyLoader", @@ -104,6 +137,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyProxiesEntity1).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + referenceNavigation.SetGetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity) => LazyProxiesEntity1EntityType.ReadReferenceNavigation(entity), + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity) => LazyProxiesEntity1EntityType.ReadReferenceNavigation(entity) == null, + (CompiledModelInMemoryTest.LazyProxiesEntity1 instance) => LazyProxiesEntity1EntityType.ReadReferenceNavigation(instance), + (CompiledModelInMemoryTest.LazyProxiesEntity1 instance) => LazyProxiesEntity1EntityType.ReadReferenceNavigation(instance) == null); + referenceNavigation.SetSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity, CompiledModelInMemoryTest.LazyProxiesEntity2 value) => LazyProxiesEntity1EntityType.WriteReferenceNavigation(entity, value)); + referenceNavigation.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity1 entity, CompiledModelInMemoryTest.LazyProxiesEntity2 value) => LazyProxiesEntity1EntityType.WriteReferenceNavigation(entity, value)); + referenceNavigation.SetAccessors( + (InternalEntityEntry entry) => LazyProxiesEntity1EntityType.ReadReferenceNavigation((CompiledModelInMemoryTest.LazyProxiesEntity1)entry.Entity), + (InternalEntityEntry entry) => LazyProxiesEntity1EntityType.ReadReferenceNavigation((CompiledModelInMemoryTest.LazyProxiesEntity1)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(referenceNavigation), + null); + referenceNavigation.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var collectionNavigation = principalEntityType.AddNavigation("CollectionNavigation", runtimeForeignKey, onDependent: false, @@ -112,15 +166,91 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyProxiesEntity2).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + collectionNavigation.SetGetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity) => LazyProxiesEntity2EntityType.ReadCollectionNavigation(entity), + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity) => LazyProxiesEntity2EntityType.ReadCollectionNavigation(entity) == null, + (CompiledModelInMemoryTest.LazyProxiesEntity2 instance) => LazyProxiesEntity2EntityType.ReadCollectionNavigation(instance), + (CompiledModelInMemoryTest.LazyProxiesEntity2 instance) => LazyProxiesEntity2EntityType.ReadCollectionNavigation(instance) == null); + collectionNavigation.SetSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, ICollection value) => LazyProxiesEntity2EntityType.WriteCollectionNavigation(entity, value)); + collectionNavigation.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, ICollection value) => LazyProxiesEntity2EntityType.WriteCollectionNavigation(entity, value)); + collectionNavigation.SetAccessors( + (InternalEntityEntry entry) => LazyProxiesEntity2EntityType.ReadCollectionNavigation((CompiledModelInMemoryTest.LazyProxiesEntity2)entry.Entity), + (InternalEntityEntry entry) => LazyProxiesEntity2EntityType.ReadCollectionNavigation((CompiledModelInMemoryTest.LazyProxiesEntity2)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(collectionNavigation), + null); + collectionNavigation.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: -1); + collectionNavigation.SetCollectionAccessor, CompiledModelInMemoryTest.LazyProxiesEntity1>( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity) => LazyProxiesEntity2EntityType.ReadCollectionNavigation(entity), + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, ICollection collection) => LazyProxiesEntity2EntityType.WriteCollectionNavigation(entity, (ICollection)collection), + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, ICollection collection) => LazyProxiesEntity2EntityType.WriteCollectionNavigation(entity, (ICollection)collection), + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelInMemoryTest.LazyProxiesEntity1>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var referenceNavigationId = runtimeEntityType.FindProperty("ReferenceNavigationId")!; + var referenceNavigation = runtimeEntityType.FindNavigation("ReferenceNavigation")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyProxiesEntity1)source.Entity; + return (ISnapshot)new Snapshot>(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue>(referenceNavigationId) == null ? null : ((ValueComparer>)referenceNavigationId.GetValueComparer()).Snapshot(source.GetCurrentValue>(referenceNavigationId))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot>(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)), default(Nullable) == null ? null : ((ValueComparer>)referenceNavigationId.GetValueComparer()).Snapshot(default(Nullable)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot>(default(int), default(Nullable))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("ReferenceNavigationId") ? (Nullable)source["ReferenceNavigationId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyProxiesEntity1)source.Entity; + return (ISnapshot)new Snapshot, object>(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue>(referenceNavigationId) == null ? null : ((ValueComparer>)referenceNavigationId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(referenceNavigationId)), ReadReferenceNavigation(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 3, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelInMemoryTest.LazyProxiesEntity1 @this); + + public static int ReadId(CompiledModelInMemoryTest.LazyProxiesEntity1 @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.LazyProxiesEntity1 @this, int value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.LazyProxiesEntity2 GetReferenceNavigation(CompiledModelInMemoryTest.LazyProxiesEntity1 @this); + + public static CompiledModelInMemoryTest.LazyProxiesEntity2 ReadReferenceNavigation(CompiledModelInMemoryTest.LazyProxiesEntity1 @this) + => GetReferenceNavigation(@this); + + public static void WriteReferenceNavigation(CompiledModelInMemoryTest.LazyProxiesEntity1 @this, CompiledModelInMemoryTest.LazyProxiesEntity2 value) + => GetReferenceNavigation(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity2EntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity2EntityType.cs index ce55edb1a87..d40e4730922 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity2EntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Lazy_loading_proxies/LazyProxiesEntity2EntityType.cs @@ -1,11 +1,16 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -34,6 +39,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity) => ReadId(entity), + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity) => ReadId(entity) == 0, + (CompiledModelInMemoryTest.LazyProxiesEntity2 instance) => ReadId(instance), + (CompiledModelInMemoryTest.LazyProxiesEntity2 instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyProxiesEntity2 entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.LazyProxiesEntity2)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.LazyProxiesEntity2)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.LazyProxiesEntity2)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -49,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var loader = runtimeEntityType.AddServiceProperty( "Loader", @@ -64,10 +91,58 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var collectionNavigation = runtimeEntityType.FindNavigation("CollectionNavigation")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyProxiesEntity2)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyProxiesEntity2)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), SnapshotFactoryFactory.SnapshotCollection(ReadCollectionNavigation(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 2, + storeGeneratedCount: 1); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelInMemoryTest.LazyProxiesEntity2 @this); + + public static int ReadId(CompiledModelInMemoryTest.LazyProxiesEntity2 @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.LazyProxiesEntity2 @this, int value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetCollectionNavigation(CompiledModelInMemoryTest.LazyProxiesEntity2 @this); + + public static ICollection ReadCollectionNavigation(CompiledModelInMemoryTest.LazyProxiesEntity2 @this) + => GetCollectionNavigation(@this); + + public static void WriteCollectionNavigation(CompiledModelInMemoryTest.LazyProxiesEntity2 @this, ICollection value) + => GetCollectionNavigation(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyConstructorEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyConstructorEntityEntityType.cs index 1268a97db57..0768e51d497 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyConstructorEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyConstructorEntityEntityType.cs @@ -1,11 +1,16 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -34,6 +39,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => ReadId(entity), + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => ReadId(entity) == 0, + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => ReadId(instance), + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -49,6 +75,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var _loader = runtimeEntityType.AddServiceProperty( "_loader", @@ -64,10 +91,68 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var lazyPropertyDelegateEntity = runtimeEntityType.FindNavigation("LazyPropertyDelegateEntity")!; + var lazyPropertyEntity = runtimeEntityType.FindNavigation("LazyPropertyEntity")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyConstructorEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyConstructorEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), ReadLazyPropertyDelegateEntity(entity), ReadLazyPropertyEntity(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 3, + storeGeneratedCount: 1); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelInMemoryTest.LazyConstructorEntity @this); + + public static int ReadId(CompiledModelInMemoryTest.LazyConstructorEntity @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.LazyConstructorEntity @this, int value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.LazyPropertyDelegateEntity GetLazyPropertyDelegateEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this); + + public static CompiledModelInMemoryTest.LazyPropertyDelegateEntity ReadLazyPropertyDelegateEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this) + => GetLazyPropertyDelegateEntity(@this); + + public static void WriteLazyPropertyDelegateEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this, CompiledModelInMemoryTest.LazyPropertyDelegateEntity value) + => GetLazyPropertyDelegateEntity(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.LazyPropertyEntity GetLazyPropertyEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this); + + public static CompiledModelInMemoryTest.LazyPropertyEntity ReadLazyPropertyEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this) + => GetLazyPropertyEntity(@this); + + public static void WriteLazyPropertyEntity(CompiledModelInMemoryTest.LazyConstructorEntity @this, CompiledModelInMemoryTest.LazyPropertyEntity value) + => GetLazyPropertyEntity(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyDelegateEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyDelegateEntityEntityType.cs index cad7a81dce0..879bbf0c0ed 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyDelegateEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyDelegateEntityEntityType.cs @@ -1,12 +1,17 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -37,6 +42,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => ReadId(entity), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => ReadId(entity) == 0, + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => ReadId(instance), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -52,6 +78,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var lazyConstructorEntityId = runtimeEntityType.AddProperty( "LazyConstructorEntityId", @@ -59,6 +86,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelInMemoryTest.LazyPropertyDelegateEntity).GetProperty("LazyConstructorEntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelInMemoryTest.LazyPropertyDelegateEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + lazyConstructorEntityId.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => ReadLazyConstructorEntityId(entity), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => ReadLazyConstructorEntityId(entity) == 0, + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => ReadLazyConstructorEntityId(instance), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => ReadLazyConstructorEntityId(instance) == 0); + lazyConstructorEntityId.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, int value) => WriteLazyConstructorEntityId(entity, value)); + lazyConstructorEntityId.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, int value) => WriteLazyConstructorEntityId(entity, value)); + lazyConstructorEntityId.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(1) : entry.FlaggedAsTemporary(1) && ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity) == 0 ? entry.ReadTemporaryValue(1) : ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + (InternalEntityEntry entry) => ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(lazyConstructorEntityId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(lazyConstructorEntityId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + lazyConstructorEntityId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); lazyConstructorEntityId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -74,6 +122,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + lazyConstructorEntityId.SetCurrentValueComparer(new EntryCurrentValueComparer(lazyConstructorEntityId)); var lazyLoader = runtimeEntityType.AddServiceProperty( "LazyLoader", @@ -113,6 +162,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyPropertyDelegateEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + lazyConstructorEntity.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity(entity), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity(entity) == null, + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity(instance), + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity instance) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity(instance) == null); + lazyConstructorEntity.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, CompiledModelInMemoryTest.LazyConstructorEntity value) => LazyPropertyDelegateEntityEntityType.WriteLazyConstructorEntity(entity, value)); + lazyConstructorEntity.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyDelegateEntity entity, CompiledModelInMemoryTest.LazyConstructorEntity value) => LazyPropertyDelegateEntityEntityType.WriteLazyConstructorEntity(entity, value)); + lazyConstructorEntity.SetAccessors( + (InternalEntityEntry entry) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + (InternalEntityEntry entry) => LazyPropertyDelegateEntityEntityType.ReadLazyConstructorEntity((CompiledModelInMemoryTest.LazyPropertyDelegateEntity)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(lazyConstructorEntity), + null); + lazyConstructorEntity.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var lazyPropertyDelegateEntity = principalEntityType.AddNavigation("LazyPropertyDelegateEntity", runtimeForeignKey, onDependent: false, @@ -121,15 +191,94 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyConstructorEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + lazyPropertyDelegateEntity.SetGetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity(entity), + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity(entity) == null, + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity(instance), + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity(instance) == null); + lazyPropertyDelegateEntity.SetSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, CompiledModelInMemoryTest.LazyPropertyDelegateEntity value) => LazyConstructorEntityEntityType.WriteLazyPropertyDelegateEntity(entity, value)); + lazyPropertyDelegateEntity.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, CompiledModelInMemoryTest.LazyPropertyDelegateEntity value) => LazyConstructorEntityEntityType.WriteLazyPropertyDelegateEntity(entity, value)); + lazyPropertyDelegateEntity.SetAccessors( + (InternalEntityEntry entry) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + (InternalEntityEntry entry) => LazyConstructorEntityEntityType.ReadLazyPropertyDelegateEntity((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(lazyPropertyDelegateEntity), + null); + lazyPropertyDelegateEntity.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var lazyConstructorEntityId = runtimeEntityType.FindProperty("LazyConstructorEntityId")!; + var lazyConstructorEntity = runtimeEntityType.FindNavigation("LazyConstructorEntity")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyPropertyDelegateEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)lazyConstructorEntityId.GetValueComparer()).Snapshot(source.GetCurrentValue(lazyConstructorEntityId))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)), ((ValueComparer)lazyConstructorEntityId.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyPropertyDelegateEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)lazyConstructorEntityId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(lazyConstructorEntityId)), ReadLazyConstructorEntity(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 0, + relationshipCount: 3, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this); + + public static int ReadId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this, int value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this); + + public static int ReadLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this) + => GetLazyConstructorEntityId(@this); + + public static void WriteLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this, int value) + => GetLazyConstructorEntityId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.LazyConstructorEntity GetLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this); + + public static CompiledModelInMemoryTest.LazyConstructorEntity ReadLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this) + => GetLazyConstructorEntity(@this); + + public static void WriteLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyDelegateEntity @this, CompiledModelInMemoryTest.LazyConstructorEntity value) + => GetLazyConstructorEntity(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyEntityEntityType.cs index dcb40a9ba14..08bca9f192d 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Manual_lazy_loading/LazyPropertyEntityEntityType.cs @@ -1,12 +1,17 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -37,6 +42,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => ReadId(entity), + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => ReadId(entity) == 0, + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => ReadId(instance), + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -52,6 +78,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var lazyConstructorEntityId = runtimeEntityType.AddProperty( "LazyConstructorEntityId", @@ -59,6 +86,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelInMemoryTest.LazyPropertyEntity).GetProperty("LazyConstructorEntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelInMemoryTest.LazyPropertyEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + lazyConstructorEntityId.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => ReadLazyConstructorEntityId(entity), + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => ReadLazyConstructorEntityId(entity) == 0, + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => ReadLazyConstructorEntityId(instance), + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => ReadLazyConstructorEntityId(instance) == 0); + lazyConstructorEntityId.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, int value) => WriteLazyConstructorEntityId(entity, value)); + lazyConstructorEntityId.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, int value) => WriteLazyConstructorEntityId(entity, value)); + lazyConstructorEntityId.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(1) : entry.FlaggedAsTemporary(1) && ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity) == 0 ? entry.ReadTemporaryValue(1) : ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + (InternalEntityEntry entry) => ReadLazyConstructorEntityId((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(lazyConstructorEntityId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(lazyConstructorEntityId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + lazyConstructorEntityId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); lazyConstructorEntityId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -74,6 +122,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), clrType: typeof(int), jsonValueReaderWriter: JsonInt32ReaderWriter.Instance); + lazyConstructorEntityId.SetCurrentValueComparer(new EntryCurrentValueComparer(lazyConstructorEntityId)); var loader = runtimeEntityType.AddServiceProperty( "Loader", @@ -108,6 +157,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyPropertyEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + lazyConstructorEntity.SetGetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity(entity), + (CompiledModelInMemoryTest.LazyPropertyEntity entity) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity(entity) == null, + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity(instance), + (CompiledModelInMemoryTest.LazyPropertyEntity instance) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity(instance) == null); + lazyConstructorEntity.SetSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, CompiledModelInMemoryTest.LazyConstructorEntity value) => LazyPropertyEntityEntityType.WriteLazyConstructorEntity(entity, value)); + lazyConstructorEntity.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyPropertyEntity entity, CompiledModelInMemoryTest.LazyConstructorEntity value) => LazyPropertyEntityEntityType.WriteLazyConstructorEntity(entity, value)); + lazyConstructorEntity.SetAccessors( + (InternalEntityEntry entry) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + (InternalEntityEntry entry) => LazyPropertyEntityEntityType.ReadLazyConstructorEntity((CompiledModelInMemoryTest.LazyPropertyEntity)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(lazyConstructorEntity), + null); + lazyConstructorEntity.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var lazyPropertyEntity = principalEntityType.AddNavigation("LazyPropertyEntity", runtimeForeignKey, onDependent: false, @@ -116,15 +186,94 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelInMemoryTest.LazyConstructorEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field); + lazyPropertyEntity.SetGetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity(entity), + (CompiledModelInMemoryTest.LazyConstructorEntity entity) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity(entity) == null, + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity(instance), + (CompiledModelInMemoryTest.LazyConstructorEntity instance) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity(instance) == null); + lazyPropertyEntity.SetSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, CompiledModelInMemoryTest.LazyPropertyEntity value) => LazyConstructorEntityEntityType.WriteLazyPropertyEntity(entity, value)); + lazyPropertyEntity.SetMaterializationSetter( + (CompiledModelInMemoryTest.LazyConstructorEntity entity, CompiledModelInMemoryTest.LazyPropertyEntity value) => LazyConstructorEntityEntityType.WriteLazyPropertyEntity(entity, value)); + lazyPropertyEntity.SetAccessors( + (InternalEntityEntry entry) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + (InternalEntityEntry entry) => LazyConstructorEntityEntityType.ReadLazyPropertyEntity((CompiledModelInMemoryTest.LazyConstructorEntity)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(lazyPropertyEntity), + null); + lazyPropertyEntity.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var lazyConstructorEntityId = runtimeEntityType.FindProperty("LazyConstructorEntityId")!; + var lazyConstructorEntity = runtimeEntityType.FindNavigation("LazyConstructorEntity")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyPropertyEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)lazyConstructorEntityId.GetValueComparer()).Snapshot(source.GetCurrentValue(lazyConstructorEntityId))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)), ((ValueComparer)lazyConstructorEntityId.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.LazyPropertyEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)lazyConstructorEntityId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(lazyConstructorEntityId)), ReadLazyConstructorEntity(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 0, + relationshipCount: 3, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelInMemoryTest.LazyPropertyEntity @this); + + public static int ReadId(CompiledModelInMemoryTest.LazyPropertyEntity @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.LazyPropertyEntity @this, int value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyEntity @this); + + public static int ReadLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyEntity @this) + => GetLazyConstructorEntityId(@this); + + public static void WriteLazyConstructorEntityId(CompiledModelInMemoryTest.LazyPropertyEntity @this, int value) + => GetLazyConstructorEntityId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.LazyConstructorEntity GetLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyEntity @this); + + public static CompiledModelInMemoryTest.LazyConstructorEntity ReadLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyEntity @this) + => GetLazyConstructorEntity(@this); + + public static void WriteLazyConstructorEntity(CompiledModelInMemoryTest.LazyPropertyEntity @this, CompiledModelInMemoryTest.LazyConstructorEntity value) + => GetLazyConstructorEntity(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/DependentBaseEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/DependentBaseEntityType.cs index a6fc7e5b7ca..3b8a6a4d0c3 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/DependentBaseEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/DependentBaseEntityType.cs @@ -1,11 +1,16 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; #pragma warning disable 219, 612, 618 @@ -33,6 +38,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.DependentBase>)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -48,12 +74,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var principalId = runtimeEntityType.AddProperty( "PrincipalId", typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 1); principalId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -69,6 +102,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); var key = runtimeEntityType.AddKey( new[] { id }); @@ -96,6 +130,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -103,15 +158,85 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Dependent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot, long>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, long>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, long>(default(Nullable), default(long))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot, long, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 3, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.DependentBase @this); + + public static long? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalBaseEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalBaseEntityType.cs index 7bf7cb637fb..938f094c7a0 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalBaseEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalBaseEntityType.cs @@ -3,11 +3,15 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.ValueGeneration; @@ -39,6 +43,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -54,12 +79,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var discriminator = runtimeEntityType.AddProperty( "Discriminator", typeof(string), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -82,6 +114,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AnEnum)0); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum1.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -104,6 +157,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum2.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -126,6 +200,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum1.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -148,6 +243,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (CompiledModelTestBase.AFlagsEnum)0); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum2.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -169,6 +285,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalId.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -184,6 +306,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); var refTypeArray = runtimeEntityType.AddProperty( "RefTypeArray", @@ -191,6 +314,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -244,6 +388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -283,6 +448,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -322,6 +508,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -375,6 +582,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -414,6 +642,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -453,6 +702,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -492,6 +762,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -549,10 +840,180 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, long, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, long>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, long>(default(Nullable), default(long))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string), default(long))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, long, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), SnapshotFactoryFactory.SnapshotCollection(ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 3, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalDerivedEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalDerivedEntityType.cs index 8ccd6c53acf..acf764465d4 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalDerivedEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/RelationshipCycles/PrincipalDerivedEntityType.cs @@ -1,9 +1,14 @@ // using System; using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -43,15 +48,96 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + deriveds.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance) == null); + deriveds.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(deriveds), + null); + deriveds.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); + deriveds.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, long, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, long>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, long>(default(Nullable), default(long))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string), default(long))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, long, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), SnapshotFactoryFactory.SnapshotCollection(PrincipalBaseEntityType.ReadDeriveds(entity)), ReadDependent(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 4, + storeGeneratedCount: 2); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; } } diff --git a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Self_referential_property/SelfReferentialEntityEntityType.cs b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Self_referential_property/SelfReferentialEntityEntityType.cs index 1260ee21117..cd2d9d6ee9c 100644 --- a/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Self_referential_property/SelfReferentialEntityEntityType.cs +++ b/test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Self_referential_property/SelfReferentialEntityEntityType.cs @@ -1,10 +1,15 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -32,6 +37,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + id.SetGetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity) => ReadId(entity), + (CompiledModelInMemoryTest.SelfReferentialEntity entity) => ReadId(entity) == 0L, + (CompiledModelInMemoryTest.SelfReferentialEntity instance) => ReadId(instance), + (CompiledModelInMemoryTest.SelfReferentialEntity instance) => ReadId(instance) == 0L); + id.SetSetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity, long value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity, long value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelInMemoryTest.SelfReferentialEntity)entry.Entity) == 0L ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelInMemoryTest.SelfReferentialEntity)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelInMemoryTest.SelfReferentialEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -47,6 +73,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), clrType: typeof(long), jsonValueReaderWriter: JsonInt64ReaderWriter.Instance); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var collection = runtimeEntityType.AddProperty( "Collection", @@ -55,6 +82,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelInMemoryTest.SelfReferentialEntity).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, valueConverter: new CompiledModelInMemoryTest.SelfReferentialPropertyValueConverter()); + collection.SetGetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity) => ReadCollection(entity), + (CompiledModelInMemoryTest.SelfReferentialEntity entity) => ReadCollection(entity) == null, + (CompiledModelInMemoryTest.SelfReferentialEntity instance) => ReadCollection(instance), + (CompiledModelInMemoryTest.SelfReferentialEntity instance) => ReadCollection(instance) == null); + collection.SetSetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity, CompiledModelInMemoryTest.SelfReferentialProperty value) => WriteCollection(entity, value)); + collection.SetMaterializationSetter( + (CompiledModelInMemoryTest.SelfReferentialEntity entity, CompiledModelInMemoryTest.SelfReferentialProperty value) => WriteCollection(entity, value)); + collection.SetAccessors( + (InternalEntityEntry entry) => ReadCollection((CompiledModelInMemoryTest.SelfReferentialEntity)entry.Entity), + (InternalEntityEntry entry) => ReadCollection((CompiledModelInMemoryTest.SelfReferentialEntity)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(collection, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(collection), + (ValueBuffer valueBuffer) => valueBuffer[1]); + collection.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); collection.TypeMapping = InMemoryTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelInMemoryTest.SelfReferentialProperty v1, CompiledModelInMemoryTest.SelfReferentialProperty v2) => object.Equals(v1, v2), @@ -86,10 +134,58 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var collection = runtimeEntityType.FindProperty("Collection")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.SelfReferentialEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(collection) == null ? null : ((ValueComparer)collection.GetValueComparer()).Snapshot(source.GetCurrentValue(collection))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(long)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelInMemoryTest.SelfReferentialEntity)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetId(CompiledModelInMemoryTest.SelfReferentialEntity @this); + + public static long ReadId(CompiledModelInMemoryTest.SelfReferentialEntity @this) + => GetId(@this); + + public static void WriteId(CompiledModelInMemoryTest.SelfReferentialEntity @this, long value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelInMemoryTest.SelfReferentialProperty GetCollection(CompiledModelInMemoryTest.SelfReferentialEntity @this); + + public static CompiledModelInMemoryTest.SelfReferentialProperty ReadCollection(CompiledModelInMemoryTest.SelfReferentialEntity @this) + => GetCollection(@this); + + public static void WriteCollection(CompiledModelInMemoryTest.SelfReferentialEntity @this, CompiledModelInMemoryTest.SelfReferentialProperty value) + => GetCollection(@this) = value; } } diff --git a/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs b/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs index 3e9741c585c..bc62e4f8e43 100644 --- a/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs +++ b/test/EFCore.NativeAotTests/CompiledModels/UserEntityType.cs @@ -33,7 +33,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba providerValueComparer: ValueComparer.CreateDefault(favorStructuralComparisons: true), sentinel: 0); id.SetSetter((User e, int v) => e.Id = v); - id.SetAccessors(new PropertyAccessors( + id.SetAccessors( (InternalEntityEntry e) => ((User)e.Entity).Id == 0 ? e.FlaggedAsStoreGenerated(0) @@ -50,7 +50,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba : ((User)e.Entity).Id, (InternalEntityEntry e) => e.ReadOriginalValue(id, 0), (InternalEntityEntry e) => e.ReadRelationshipSnapshotValue(id, 0), - valueBuffer => valueBuffer[0]!)); + valueBuffer => valueBuffer[0]!); id.TypeMapping = IntTypeMapping.Default; id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -62,12 +62,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType? ba valueComparer: ValueComparer.CreateDefault(favorStructuralComparisons: false), providerValueComparer: ValueComparer.CreateDefault(favorStructuralComparisons: true)); name.SetSetter((User e, string v) => e.Name = v); - name.SetAccessors(new PropertyAccessors( + name.SetAccessors( (InternalEntityEntry e) => ((User)e.Entity).Name, (InternalEntityEntry e) => ((User)e.Entity).Name, (InternalEntityEntry e) => e.ReadOriginalValue(name, 1), (InternalEntityEntry e) => e.ReadRelationshipSnapshotValue(name, 1), - valueBuffer => valueBuffer[1]!)); + valueBuffer => valueBuffer[1]!); name.TypeMapping = SqlServerStringTypeMapping.Default; name.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); diff --git a/test/EFCore.Relational.Specification.Tests/Scaffolding/CompiledModelRelationalTestBase.cs b/test/EFCore.Relational.Specification.Tests/Scaffolding/CompiledModelRelationalTestBase.cs index f8d50cdce50..3c4b38dcfd0 100644 --- a/test/EFCore.Relational.Specification.Tests/Scaffolding/CompiledModelRelationalTestBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Scaffolding/CompiledModelRelationalTestBase.cs @@ -25,11 +25,14 @@ public virtual void BigModel_with_JSON_columns() { Id = 1, AlternateId = new Guid(), - Dependent = new DependentBase(1), + Dependent = new DependentDerived(1, "one"), Owned = new OwnedType(c) }); c.SaveChanges(); + + var dependent = c.Set>>().Include(p => p.Dependent).Single().Dependent!; + Assert.Equal("one", ((DependentDerived)dependent).GetData()); }, options: new CompiledModelCodeGenerationOptions { UseNullableReferenceTypes = true }); @@ -87,7 +90,7 @@ protected override void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumn } else { - ob.ToTable("ManyOwned", t => t.ExcludeFromMigrations()); + ob.ToTable("ManyOwned"); } }); @@ -95,8 +98,13 @@ protected override void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumn .UsingEntity( jb => { - jb.ToTable(tb => tb.HasComment("Join table")); + jb.ToTable(tb => + { + tb.HasComment("Join table"); + tb.ExcludeFromMigrations(); + }); jb.Property("rowid") + .IsRowVersion() .HasComment("RowVersion") .HasColumnOrder(1); }); @@ -206,12 +214,6 @@ protected override void AssertBigModel(IModel model, bool jsonColumns) var referenceOwnership = referenceOwnedNavigation.ForeignKey; var ownedCollectionNavigation = principalDerived.GetDeclaredNavigations().Last(); - var collectionOwnedType = ownedCollectionNavigation.TargetEntityType; - Assert.Null(collectionOwnedType[RelationalAnnotationNames.IsTableExcludedFromMigrations]); - Assert.Equal( - CoreStrings.RuntimeModelMissingData, - Assert.Throws(() => collectionOwnedType.IsTableExcludedFromMigrations()).Message); - var collectionOwnership = ownedCollectionNavigation.ForeignKey; var tptForeignKey = principalDerived.GetForeignKeys().SingleOrDefault(); @@ -243,15 +245,19 @@ protected override void AssertBigModel(IModel model, bool jsonColumns) Assert.Null(joinType[RelationalAnnotationNames.Comment]); Assert.Equal( CoreStrings.RuntimeModelMissingData, - Assert.Throws(() => joinType.GetComment()).Message); + Assert.Throws(joinType.GetComment).Message); Assert.Null(joinType.GetQueryFilter()); + Assert.Null(joinType[RelationalAnnotationNames.IsTableExcludedFromMigrations]); + Assert.Equal( + CoreStrings.RuntimeModelMissingData, + Assert.Throws(() => joinType.IsTableExcludedFromMigrations()).Message); var rowid = joinType.GetProperties().Single(p => !p.IsForeignKey()); Assert.Equal("rowid", rowid.GetColumnName()); Assert.Null(rowid[RelationalAnnotationNames.Comment]); Assert.Equal( CoreStrings.RuntimeModelMissingData, - Assert.Throws(() => rowid.GetComment()).Message); + Assert.Throws(rowid.GetComment).Message); Assert.Null(rowid[RelationalAnnotationNames.ColumnOrder]); Assert.Equal( CoreStrings.RuntimeModelMissingData, @@ -265,6 +271,12 @@ protected override void AssertBigModel(IModel model, bool jsonColumns) var dependentBaseForeignKey = dependentBase.GetForeignKeys().Single(fk => fk != dependentForeignKey); + var joinTable = joinType.GetTableMappings().Single().Table; + Assert.Null(joinTable[RelationalAnnotationNames.Comment]); + Assert.Equal( + CoreStrings.RuntimeModelMissingData, + Assert.Throws(() => joinTable.Comment).Message); + var dependentMoney = dependentDerived.GetDeclaredProperties().Last(); Assert.Equal("Money", dependentMoney.GetColumnName()); Assert.Null(dependentMoney.IsFixedLength()); diff --git a/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs b/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs index 09c218bd0e4..8254ad4793c 100644 --- a/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs +++ b/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs @@ -1418,15 +1418,10 @@ protected static MethodInfo GetMethod( string name, int genericParameterCount, Func parameterGenerator) - => type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly) - .Single( - mi => mi.Name == name - && ((genericParameterCount == 0 && !mi.IsGenericMethod) - || (mi.IsGenericMethod && mi.GetGenericArguments().Length == genericParameterCount)) - && mi.GetParameters().Select(e => e.ParameterType).SequenceEqual( - parameterGenerator( - type.IsGenericType ? type.GetGenericArguments() : [], - mi.IsGenericMethod ? mi.GetGenericArguments() : []))); + => type.GetGenericMethod(name, + genericParameterCount, + BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly, + parameterGenerator); protected virtual void Initialize() { diff --git a/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs b/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs index e06bda7dd35..bb84185f93f 100644 --- a/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs +++ b/test/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs @@ -114,8 +114,6 @@ protected virtual void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumns jb.Property("rowid") .IsRowVersion(); }); - - eb.Navigation(e => e.Principals).AutoInclude().EnableLazyLoading(false); }); modelBuilder.Entity>( @@ -417,8 +415,8 @@ protected virtual void AssertBigModel(IModel model, bool jsonColumns) Assert.Equal("k__BackingField", derivedSkipNavigation.FieldInfo!.Name); Assert.Equal(typeof(ICollection), derivedSkipNavigation.ClrType); Assert.True(derivedSkipNavigation.IsCollection); - Assert.True(derivedSkipNavigation.IsEagerLoaded); - Assert.False(derivedSkipNavigation.LazyLoadingEnabled); + Assert.False(derivedSkipNavigation.IsEagerLoaded); + Assert.True(derivedSkipNavigation.LazyLoadingEnabled); Assert.False(derivedSkipNavigation.IsOnDependent); Assert.Equal(principalDerived, derivedSkipNavigation.DeclaringEntityType); Assert.Equal("Deriveds", derivedSkipNavigation.Inverse.Name); @@ -1067,9 +1065,16 @@ public class DependentBase(TKey id) : AbstractBase public PrincipalDerived>? Principal { get; set; } } - public class DependentDerived(TKey id) : DependentBase(id) + public class DependentDerived : DependentBase { + public DependentDerived(TKey id, string data) + : base(id) + { + Data = data; + } + private string? Data { get; set; } + public string? GetData() => Data; } public class OwnedType : INotifyPropertyChanged, INotifyPropertyChanging diff --git a/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj b/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj index 15c599dc131..5ed63c0a1cd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj +++ b/test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj @@ -74,4 +74,8 @@ + + + + diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs index 3cdcf6afeae..11c27ed7864 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs @@ -1,9 +1,13 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -38,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -51,6 +61,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); principalId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalAlternateId = runtimeEntityType.AddProperty( @@ -58,6 +69,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -73,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalAlternateId)); principalAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var enumDiscriminator = runtimeEntityType.AddProperty( @@ -80,6 +98,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum1), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + enumDiscriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: -1, + storeGenerationIndex: -1); enumDiscriminator.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum1 v1, CompiledModelTestBase.Enum1 v2) => object.Equals((object)v1, (object)v2), @@ -110,6 +134,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[3]); + id.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -164,6 +209,27 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -173,11 +239,65 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt eagerLoaded: true, lazyLoadingEnabled: false); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 4, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 4, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("DiscriminatorMappingComplete", false); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); @@ -191,5 +311,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetId(CompiledModelTestBase.DependentBase @this); + + public static byte? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, byte? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs index bc3c7e5d733..c8b2ff10716 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs @@ -1,8 +1,12 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -32,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 20, unicode: false); + data.SetGetter( + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity), + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity) == null, + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance), + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance) == null); + data.SetSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetMaterializationSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetAccessors( + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(data, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(data), + (ValueBuffer valueBuffer) => valueBuffer[4]); + data.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); data.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -59,6 +84,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas precision: 9, scale: 3, sentinel: 0m); + money.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 3, + relationshipIndex: -1, + storeGenerationIndex: -1); money.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -83,6 +114,41 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var data = runtimeEntityType.FindProperty("Data")!; + var money = runtimeEntityType.FindProperty("Money")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot, string, decimal>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(data) == null ? null : ((ValueComparer)data.GetValueComparer()).Snapshot(source.GetCurrentValue(data)), ((ValueComparer)money.GetValueComparer()).Snapshot(source.GetCurrentValue(money))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default, source.ContainsKey("Money") ? (decimal)source["Money"] : 0M)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1), default(decimal))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), DependentBaseEntityType.ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 6, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 6, + shadowCount: 4, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -94,5 +160,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetData(CompiledModelTestBase.DependentDerived @this); + + public static string ReadData(CompiledModelTestBase.DependentDerived @this) + => GetData(@this); + + public static void WriteData(CompiledModelTestBase.DependentDerived @this, string value) + => GetData(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs index 03df4d23893..ee30773de2f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs @@ -7,9 +7,12 @@ using System.Net; using System.Net.NetworkInformation; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -41,6 +44,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, valueConverter: new CompiledModelTestBase.ManyTypesIdConverter()); + id.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity).Equals(default(CompiledModelTestBase.ManyTypesId)), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance).Equals(default(CompiledModelTestBase.ManyTypesId))); + id.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelTestBase.ManyTypes)entry.Entity).Equals(default(CompiledModelTestBase.ManyTypesId)) ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.ManyTypesId v1, CompiledModelTestBase.ManyTypesId v2) => v1.Equals(v2), @@ -62,6 +86,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (CompiledModelTestBase.ManyTypesId v) => v.Id, (int v) => new CompiledModelTestBase.ManyTypesId(v)))); + id.SetCurrentValueComparer(new CurrentProviderValueComparer(id)); id.SetSentinelFromProviderValue(0); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -71,6 +96,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + @bool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance) == false); + @bool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetAccessors( + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@bool, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(@bool), + (ValueBuffer valueBuffer) => valueBuffer[1]); + @bool.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @bool.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -91,6 +137,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance) == null); + boolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetAccessors( + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolArray, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolArray), + (ValueBuffer valueBuffer) => valueBuffer[2]); + boolArray.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -133,6 +200,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance) == false); + boolToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToStringConverterProperty, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[3]); + boolToStringConverterProperty.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -167,6 +255,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToTwoValuesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToTwoValuesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance) == false); + boolToTwoValuesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToTwoValuesConverterProperty, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToTwoValuesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[4]); + boolToTwoValuesConverterProperty.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToTwoValuesConverterProperty.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -197,6 +306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToZeroOneConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BoolToZeroOneConverter()); + boolToZeroOneConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance) == false); + boolToZeroOneConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToZeroOneConverterProperty, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToZeroOneConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[5]); + boolToZeroOneConverterProperty.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToZeroOneConverterProperty.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -226,19 +356,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance) == null); + bytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetAccessors( + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytes, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytes), + (ValueBuffer valueBuffer) => valueBuffer[6]); + bytes.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytes.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -249,15 +400,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance) == null); + bytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + bytesArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -273,17 +445,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas JsonByteArrayReaderWriter.Instance), elementMapping: SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None)); @@ -296,15 +468,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BytesToStringConverter(), valueComparer: new ArrayStructuralComparer()); + bytesToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance) == null); + bytesToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesToStringConverterProperty, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[8]); + bytesToStringConverterProperty.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -314,13 +507,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas unicode: true, dbType: System.Data.DbType.String), converter: new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)), storeTypePostfix: StoreTypePostfix.None, jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonStringReaderWriter.Instance, new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)))); bytesToStringConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -330,6 +523,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CastingConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CastingConverter()); + castingConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance) == 0); + castingConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(castingConverterProperty, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(castingConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[9]); + castingConverterProperty.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); castingConverterProperty.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -359,6 +573,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Char", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @char.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance) == '\0'); + @char.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetAccessors( + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@char, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(@char), + (ValueBuffer valueBuffer) => valueBuffer[10]); + @char.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @char.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -393,6 +628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + charArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance) == null); + charArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetAccessors( + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(charArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + charArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (char v1, char v2) => v1 == v2, @@ -457,6 +713,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CharToStringConverter()); + charToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance) == '\0'); + charToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charToStringConverterProperty, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(charToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[12]); + charToStringConverterProperty.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -494,6 +771,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateOnly(1, 1, 1)); + dateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance) == default(DateOnly)); + dateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnly, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnly), + (ValueBuffer valueBuffer) => valueBuffer[13]); + dateOnly.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnly.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -514,6 +812,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance) == null); + dateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyArray, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[14]); + dateOnlyArray.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -557,6 +876,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateOnlyToStringConverter()); + dateOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance) == default(DateOnly)); + dateOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyToStringConverterProperty, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[15]); + dateOnlyToStringConverterProperty.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -592,6 +932,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance) == default(DateTime)); + dateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetAccessors( + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTime, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTime), + (ValueBuffer valueBuffer) => valueBuffer[16]); + dateTime.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTime.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -612,6 +973,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance) == null); + dateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + dateTimeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -655,6 +1037,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBinaryConverter()); + dateTimeOffsetToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBinaryConverterProperty, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[18]); + dateTimeOffsetToBinaryConverterProperty.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBinaryConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -685,6 +1088,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBytesConverter()); + dateTimeOffsetToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBytesConverterProperty, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[19]); + dateTimeOffsetToBytesConverterProperty.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -695,20 +1119,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (DateTimeOffset v) => v.GetHashCode(), (DateTimeOffset v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(12)", size: 12), converter: new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); dateTimeOffsetToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); dateTimeOffsetToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -718,6 +1142,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToStringConverter()); + dateTimeOffsetToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToStringConverterProperty, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[20]); + dateTimeOffsetToStringConverterProperty.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -753,6 +1198,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToBinaryConverter()); + dateTimeToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance) == default(DateTime)); + dateTimeToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToBinaryConverterProperty, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[21]); + dateTimeToBinaryConverterProperty.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToBinaryConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -783,6 +1249,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToStringConverter()); + dateTimeToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance) == default(DateTime)); + dateTimeToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToStringConverterProperty, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[22]); + dateTimeToStringConverterProperty.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -818,6 +1305,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTimeToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance) == default(DateTime)); + dateTimeToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToTicksConverterProperty, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[23]); + dateTimeToTicksConverterProperty.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToTicksConverterProperty.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -839,6 +1347,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Decimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0m); + @decimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance) == 0M); + @decimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetAccessors( + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@decimal, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue(@decimal), + (ValueBuffer valueBuffer) => valueBuffer[24]); + @decimal.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @decimal.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -859,6 +1388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + decimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance) == null); + decimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalArray, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalArray), + (ValueBuffer valueBuffer) => valueBuffer[25]); + decimalArray.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -902,6 +1452,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + decimalNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance) == 0M); + decimalNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToBytesConverterProperty, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[26]); + decimalNumberToBytesConverterProperty.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -912,20 +1483,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); decimalNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); decimalNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -935,6 +1506,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + decimalNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance) == 0M); + decimalNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToStringConverterProperty, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[27]); + decimalNumberToStringConverterProperty.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -970,6 +1562,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Double", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0.0); + @double.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance).Equals(0D)); + @double.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetAccessors( + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@double, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(@double), + (ValueBuffer valueBuffer) => valueBuffer[28]); + @double.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @double.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -990,6 +1603,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + doubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance) == null); + doubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleArray, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleArray), + (ValueBuffer valueBuffer) => valueBuffer[29]); + doubleArray.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1033,6 +1667,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + doubleNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance).Equals(0D)); + doubleNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToBytesConverterProperty, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[30]); + doubleNumberToBytesConverterProperty.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1043,20 +1698,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (double v) => v.GetHashCode(), (double v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(8)", size: 8), converter: new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); doubleNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }); doubleNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -1066,6 +1721,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + doubleNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance).Equals(0D)); + doubleNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToStringConverterProperty, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[31]); + doubleNumberToStringConverterProperty.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1100,6 +1776,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16), + (ValueBuffer valueBuffer) => valueBuffer[32]); + enum16.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1129,6 +1826,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance) == null); + enum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16Array, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16Array), + (ValueBuffer valueBuffer) => valueBuffer[33]); + enum16Array.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1188,6 +1906,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16AsString(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16AsString(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsString, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[34]); + enum16AsString.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1222,6 +1961,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance) == null); + enum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsStringArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + enum16AsStringArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1285,6 +2045,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance) == null); + enum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16AsStringCollection, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[36]); + enum16AsStringCollection.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1348,6 +2129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance) == null); + enum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16Collection, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[37]); + enum16Collection.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1406,6 +2208,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32), + (ValueBuffer valueBuffer) => valueBuffer[38]); + enum32.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1435,6 +2258,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance) == null); + enum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32Array, 39), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32Array), + (ValueBuffer valueBuffer) => valueBuffer[39]); + enum32Array.SetPropertyIndexes( + index: 39, + originalValueIndex: 39, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1494,6 +2338,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32AsString(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32AsString(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsString, 40), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[40]); + enum32AsString.SetPropertyIndexes( + index: 40, + originalValueIndex: 40, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1528,6 +2393,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance) == null); + enum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsStringArray, 41), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[41]); + enum32AsStringArray.SetPropertyIndexes( + index: 41, + originalValueIndex: 41, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1591,6 +2477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance) == null); + enum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32AsStringCollection, 42), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[42]); + enum32AsStringCollection.SetPropertyIndexes( + index: 42, + originalValueIndex: 42, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1654,6 +2561,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance) == null); + enum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32Collection, 43), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[43]); + enum32Collection.SetPropertyIndexes( + index: 43, + originalValueIndex: 43, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1712,6 +2640,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64, 44), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64), + (ValueBuffer valueBuffer) => valueBuffer[44]); + enum64.SetPropertyIndexes( + index: 44, + originalValueIndex: 44, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1741,6 +2690,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance) == null); + enum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64Array, 45), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64Array), + (ValueBuffer valueBuffer) => valueBuffer[45]); + enum64Array.SetPropertyIndexes( + index: 45, + originalValueIndex: 45, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1800,6 +2770,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64AsString(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64AsString(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsString, 46), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[46]); + enum64AsString.SetPropertyIndexes( + index: 46, + originalValueIndex: 46, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1834,6 +2825,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance) == null); + enum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsStringArray, 47), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[47]); + enum64AsStringArray.SetPropertyIndexes( + index: 47, + originalValueIndex: 47, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1897,6 +2909,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance) == null); + enum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64AsStringCollection, 48), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[48]); + enum64AsStringCollection.SetPropertyIndexes( + index: 48, + originalValueIndex: 48, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1960,6 +2993,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance) == null); + enum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64Collection, 49), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[49]); + enum64Collection.SetPropertyIndexes( + index: 49, + originalValueIndex: 49, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -2018,6 +3072,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8, 50), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8), + (ValueBuffer valueBuffer) => valueBuffer[50]); + enum8.SetPropertyIndexes( + index: 50, + originalValueIndex: 50, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2047,6 +3122,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance) == null); + enum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8Array, 51), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8Array), + (ValueBuffer valueBuffer) => valueBuffer[51]); + enum8Array.SetPropertyIndexes( + index: 51, + originalValueIndex: 51, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2106,6 +3202,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8AsString(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8AsString(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsString, 52), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[52]); + enum8AsString.SetPropertyIndexes( + index: 52, + originalValueIndex: 52, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2140,6 +3257,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance) == null); + enum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsStringArray, 53), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[53]); + enum8AsStringArray.SetPropertyIndexes( + index: 53, + originalValueIndex: 53, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2203,6 +3341,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance) == null); + enum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8AsStringCollection, 54), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[54]); + enum8AsStringCollection.SetPropertyIndexes( + index: 54, + originalValueIndex: 54, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2266,6 +3425,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance) == null); + enum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8Collection, 55), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[55]); + enum8Collection.SetPropertyIndexes( + index: 55, + originalValueIndex: 55, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2325,6 +3505,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToNumberConverter()); + enumToNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToNumberConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToNumberConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToNumberConverterProperty, 56), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[56]); + enumToNumberConverterProperty.SetPropertyIndexes( + index: 56, + originalValueIndex: 56, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2355,6 +3556,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToStringConverter()); + enumToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToStringConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToStringConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToStringConverterProperty, 57), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[57]); + enumToStringConverterProperty.SetPropertyIndexes( + index: 57, + originalValueIndex: 57, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2389,6 +3611,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16, 58), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16), + (ValueBuffer valueBuffer) => valueBuffer[58]); + enumU16.SetPropertyIndexes( + index: 58, + originalValueIndex: 58, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2418,6 +3661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance) == null); + enumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16Array, 59), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[59]); + enumU16Array.SetPropertyIndexes( + index: 59, + originalValueIndex: 59, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2477,6 +3741,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16AsString(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16AsString(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsString, 60), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[60]); + enumU16AsString.SetPropertyIndexes( + index: 60, + originalValueIndex: 60, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2511,6 +3796,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance) == null); + enumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsStringArray, 61), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[61]); + enumU16AsStringArray.SetPropertyIndexes( + index: 61, + originalValueIndex: 61, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2574,6 +3880,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance) == null); + enumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16AsStringCollection, 62), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[62]); + enumU16AsStringCollection.SetPropertyIndexes( + index: 62, + originalValueIndex: 62, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2637,6 +3964,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance) == null); + enumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16Collection, 63), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[63]); + enumU16Collection.SetPropertyIndexes( + index: 63, + originalValueIndex: 63, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2695,6 +4043,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32, 64), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32), + (ValueBuffer valueBuffer) => valueBuffer[64]); + enumU32.SetPropertyIndexes( + index: 64, + originalValueIndex: 64, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2724,6 +4093,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance) == null); + enumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32Array, 65), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[65]); + enumU32Array.SetPropertyIndexes( + index: 65, + originalValueIndex: 65, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2783,6 +4173,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32AsString(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32AsString(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsString, 66), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[66]); + enumU32AsString.SetPropertyIndexes( + index: 66, + originalValueIndex: 66, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2817,6 +4228,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance) == null); + enumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsStringArray, 67), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[67]); + enumU32AsStringArray.SetPropertyIndexes( + index: 67, + originalValueIndex: 67, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2880,6 +4312,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance) == null); + enumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32AsStringCollection, 68), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[68]); + enumU32AsStringCollection.SetPropertyIndexes( + index: 68, + originalValueIndex: 68, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2943,6 +4396,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance) == null); + enumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32Collection, 69), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[69]); + enumU32Collection.SetPropertyIndexes( + index: 69, + originalValueIndex: 69, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -3001,6 +4475,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64, 70), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64), + (ValueBuffer valueBuffer) => valueBuffer[70]); + enumU64.SetPropertyIndexes( + index: 70, + originalValueIndex: 70, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3034,6 +4529,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance) == null); + enumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64Array, 71), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[71]); + enumU64Array.SetPropertyIndexes( + index: 71, + originalValueIndex: 71, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3097,6 +4613,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64AsString(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64AsString(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsString, 72), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[72]); + enumU64AsString.SetPropertyIndexes( + index: 72, + originalValueIndex: 72, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3131,6 +4668,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance) == null); + enumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsStringArray, 73), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[73]); + enumU64AsStringArray.SetPropertyIndexes( + index: 73, + originalValueIndex: 73, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3194,6 +4752,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance) == null); + enumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64AsStringCollection, 74), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[74]); + enumU64AsStringCollection.SetPropertyIndexes( + index: 74, + originalValueIndex: 74, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3257,6 +4836,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance) == null); + enumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64Collection, 75), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[75]); + enumU64Collection.SetPropertyIndexes( + index: 75, + originalValueIndex: 75, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3319,6 +4919,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8, 76), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8), + (ValueBuffer valueBuffer) => valueBuffer[76]); + enumU8.SetPropertyIndexes( + index: 76, + originalValueIndex: 76, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3348,6 +4969,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance) == null); + enumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8Array, 77), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[77]); + enumU8Array.SetPropertyIndexes( + index: 77, + originalValueIndex: 77, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3407,6 +5049,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8AsString(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8AsString(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsString, 78), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[78]); + enumU8AsString.SetPropertyIndexes( + index: 78, + originalValueIndex: 78, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3441,6 +5104,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance) == null); + enumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsStringArray, 79), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[79]); + enumU8AsStringArray.SetPropertyIndexes( + index: 79, + originalValueIndex: 79, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3504,6 +5188,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance) == null); + enumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8AsStringCollection, 80), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[80]); + enumU8AsStringCollection.SetPropertyIndexes( + index: 80, + originalValueIndex: 80, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3567,6 +5272,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance) == null); + enumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8Collection, 81), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[81]); + enumU8Collection.SetPropertyIndexes( + index: 81, + originalValueIndex: 81, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3626,6 +5352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Float", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0f); + @float.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity).Equals(0F), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance).Equals(0F)); + @float.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetAccessors( + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@float, 82), + (InternalEntityEntry entry) => entry.GetCurrentValue(@float), + (ValueBuffer valueBuffer) => valueBuffer[82]); + @float.SetPropertyIndexes( + index: 82, + originalValueIndex: 82, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @float.TypeMapping = SqlServerFloatTypeMapping.Default.Clone( comparer: new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3646,6 +5393,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("FloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + floatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance) == null); + floatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetAccessors( + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(floatArray, 83), + (InternalEntityEntry entry) => entry.GetCurrentValue(floatArray), + (ValueBuffer valueBuffer) => valueBuffer[83]); + floatArray.SetPropertyIndexes( + index: 83, + originalValueIndex: 83, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); floatArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3689,6 +5457,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Guid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetAccessors( + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guid, 84), + (InternalEntityEntry entry) => entry.GetCurrentValue(guid), + (ValueBuffer valueBuffer) => valueBuffer[84]); + guid.SetPropertyIndexes( + index: 84, + originalValueIndex: 84, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guid.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3711,6 +5500,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + guidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance) == null); + guidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetAccessors( + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidArray, 85), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidArray), + (ValueBuffer valueBuffer) => valueBuffer[85]); + guidArray.SetPropertyIndexes( + index: 85, + originalValueIndex: 85, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3756,6 +5566,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToBytesConverter()); + guidToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToBytesConverterProperty, 86), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[86]); + guidToBytesConverterProperty.SetPropertyIndexes( + index: 86, + originalValueIndex: 86, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3766,20 +5597,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v.GetHashCode(), (Guid v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)), + (byte[] v) => new Guid(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)))); + (byte[] v) => new Guid(v)))); guidToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); guidToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -3789,6 +5620,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToStringConverter()); + guidToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToStringConverterProperty, 87), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[87]); + guidToStringConverterProperty.SetPropertyIndexes( + index: 87, + originalValueIndex: 87, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3823,6 +5675,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance) == null); + iPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddress, 88), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddress), + (ValueBuffer valueBuffer) => valueBuffer[88]); + iPAddress.SetPropertyIndexes( + index: 88, + originalValueIndex: 88, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3856,6 +5729,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance) == null); + iPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressArray, 89), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[89]); + iPAddressArray.SetPropertyIndexes( + index: 89, + originalValueIndex: 89, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3920,6 +5814,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToBytesConverter()); + iPAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance) == null); + iPAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToBytesConverterProperty, 90), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[90]); + iPAddressToBytesConverterProperty.SetPropertyIndexes( + index: 90, + originalValueIndex: 90, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3930,20 +5845,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (IPAddress v) => v.GetHashCode(), (IPAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)), + (byte[] v) => new IPAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)))); + (byte[] v) => new IPAddress(v)))); iPAddressToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var iPAddressToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3952,6 +5867,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToStringConverter()); + iPAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance) == null); + iPAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToStringConverterProperty, 91), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[91]); + iPAddressToStringConverterProperty.SetPropertyIndexes( + index: 91, + originalValueIndex: 91, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3986,6 +5922,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); + int16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance) == 0); + int16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetAccessors( + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16, 92), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16), + (ValueBuffer valueBuffer) => valueBuffer[92]); + int16.SetPropertyIndexes( + index: 92, + originalValueIndex: 92, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (short v1, short v2) => v1 == v2, @@ -4006,6 +5963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance) == null); + int16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16Array, 93), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16Array), + (ValueBuffer valueBuffer) => valueBuffer[93]); + int16Array.SetPropertyIndexes( + index: 93, + originalValueIndex: 93, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -4049,6 +6027,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + int32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance) == 0); + int32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetAccessors( + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32, 94), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32), + (ValueBuffer valueBuffer) => valueBuffer[94]); + int32.SetPropertyIndexes( + index: 94, + originalValueIndex: 94, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4069,6 +6068,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance) == null); + int32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32Array, 95), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32Array), + (ValueBuffer valueBuffer) => valueBuffer[95]); + int32Array.SetPropertyIndexes( + index: 95, + originalValueIndex: 95, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4112,6 +6132,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0L); + int64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity) == 0L, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance) == 0L); + int64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetAccessors( + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64, 96), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64), + (ValueBuffer valueBuffer) => valueBuffer[96]); + int64.SetPropertyIndexes( + index: 96, + originalValueIndex: 96, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -4132,6 +6173,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance) == null); + int64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64Array, 97), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64Array), + (ValueBuffer valueBuffer) => valueBuffer[97]); + int64Array.SetPropertyIndexes( + index: 97, + originalValueIndex: 97, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (long v1, long v2) => v1 == v2, @@ -4174,6 +6236,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance) == 0); + int8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetAccessors( + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8, 98), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8), + (ValueBuffer valueBuffer) => valueBuffer[98]); + int8.SetPropertyIndexes( + index: 98, + originalValueIndex: 98, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -4203,6 +6286,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance) == null); + int8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8Array, 99), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8Array), + (ValueBuffer valueBuffer) => valueBuffer[99]); + int8Array.SetPropertyIndexes( + index: 99, + originalValueIndex: 99, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -4262,6 +6366,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + intNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance) == 0); + intNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToBytesConverterProperty, 100), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[100]); + intNumberToBytesConverterProperty.SetPropertyIndexes( + index: 100, + originalValueIndex: 100, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4272,20 +6397,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v, (int v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(4)", size: 4), converter: new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); intNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0 }); intNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -4295,6 +6420,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + intNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance) == 0); + intNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToStringConverterProperty, 101), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[101]); + intNumberToStringConverterProperty.SetPropertyIndexes( + index: 101, + originalValueIndex: 101, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4331,6 +6477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, valueConverter: new CompiledModelTestBase.NullIntToNullStringConverter()); + nullIntToNullStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullIntToNullStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullIntToNullStringConverterProperty(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullIntToNullStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullIntToNullStringConverterProperty(instance).HasValue); + nullIntToNullStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullIntToNullStringConverterProperty, 102), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullIntToNullStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[102]); + nullIntToNullStringConverterProperty.SetPropertyIndexes( + index: 102, + originalValueIndex: 102, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullIntToNullStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1 == v2, @@ -4367,6 +6534,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBool(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableBool(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBool(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableBool(instance).HasValue); + nullableBool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableBool, 103), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableBool), + (ValueBuffer valueBuffer) => valueBuffer[103]); + nullableBool.SetPropertyIndexes( + index: 103, + originalValueIndex: 103, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBool.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -4387,6 +6575,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBoolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance) == null); + nullableBoolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableBoolArray, 104), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableBoolArray), + (ValueBuffer valueBuffer) => valueBuffer[104]); + nullableBoolArray.SetPropertyIndexes( + index: 104, + originalValueIndex: 104, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBoolArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -4430,19 +6639,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance) == null); + nullableBytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytes, 105), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytes), + (ValueBuffer valueBuffer) => valueBuffer[105]); + nullableBytes.SetPropertyIndexes( + index: 105, + originalValueIndex: 105, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytes.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -4453,15 +6683,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance) == null); + nullableBytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytesArray, 106), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytesArray), + (ValueBuffer valueBuffer) => valueBuffer[106]); + nullableBytesArray.SetPropertyIndexes( + index: 106, + originalValueIndex: 106, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytesArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -4477,17 +6728,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas JsonByteArrayReaderWriter.Instance), elementMapping: SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None)); @@ -4499,6 +6750,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableChar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableChar.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableChar(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableChar(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableChar(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableChar(instance).HasValue); + nullableChar.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetAccessors( + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableChar, 107), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableChar), + (ValueBuffer valueBuffer) => valueBuffer[107]); + nullableChar.SetPropertyIndexes( + index: 107, + originalValueIndex: 107, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableChar.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -4532,6 +6804,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableCharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableCharArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance) == null); + nullableCharArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableCharArray, 108), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableCharArray), + (ValueBuffer valueBuffer) => valueBuffer[108]); + nullableCharArray.SetPropertyIndexes( + index: 108, + originalValueIndex: 108, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableCharArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -4596,6 +6889,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateOnly(instance).HasValue); + nullableDateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateOnly, 109), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateOnly), + (ValueBuffer valueBuffer) => valueBuffer[109]); + nullableDateOnly.SetPropertyIndexes( + index: 109, + originalValueIndex: 109, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnly.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -4616,6 +6930,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance) == null); + nullableDateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateOnlyArray, 110), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[110]); + nullableDateOnlyArray.SetPropertyIndexes( + index: 110, + originalValueIndex: 110, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -4659,6 +6994,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateTime(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateTime(instance).HasValue); + nullableDateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateTime, 111), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateTime), + (ValueBuffer valueBuffer) => valueBuffer[111]); + nullableDateTime.SetPropertyIndexes( + index: 111, + originalValueIndex: 111, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTime.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -4679,6 +7035,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance) == null); + nullableDateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateTimeArray, 112), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[112]); + nullableDateTimeArray.SetPropertyIndexes( + index: 112, + originalValueIndex: 112, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTimeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -4722,6 +7099,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDecimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDecimal(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDecimal(instance).HasValue); + nullableDecimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDecimal, 113), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDecimal), + (ValueBuffer valueBuffer) => valueBuffer[113]); + nullableDecimal.SetPropertyIndexes( + index: 113, + originalValueIndex: 113, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimal.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4742,6 +7140,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDecimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance) == null); + nullableDecimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDecimalArray, 114), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDecimalArray), + (ValueBuffer valueBuffer) => valueBuffer[114]); + nullableDecimalArray.SetPropertyIndexes( + index: 114, + originalValueIndex: 114, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimalArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4785,6 +7204,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDouble", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDouble.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDouble(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDouble(instance).HasValue); + nullableDouble.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDouble, 115), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDouble), + (ValueBuffer valueBuffer) => valueBuffer[115]); + nullableDouble.SetPropertyIndexes( + index: 115, + originalValueIndex: 115, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDouble.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4805,6 +7245,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDoubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance) == null); + nullableDoubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDoubleArray, 116), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDoubleArray), + (ValueBuffer valueBuffer) => valueBuffer[116]); + nullableDoubleArray.SetPropertyIndexes( + index: 116, + originalValueIndex: 116, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDoubleArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4848,6 +7309,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16(instance).HasValue); + nullableEnum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16, 117), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16), + (ValueBuffer valueBuffer) => valueBuffer[117]); + nullableEnum16.SetPropertyIndexes( + index: 117, + originalValueIndex: 117, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4876,6 +7358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance) == null); + nullableEnum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16Array, 118), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16Array), + (ValueBuffer valueBuffer) => valueBuffer[118]); + nullableEnum16Array.SetPropertyIndexes( + index: 118, + originalValueIndex: 118, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4935,6 +7438,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16AsString(instance).HasValue); + nullableEnum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16AsString, 119), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[119]); + nullableEnum16AsString.SetPropertyIndexes( + index: 119, + originalValueIndex: 119, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsString.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4963,6 +7487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance) == null); + nullableEnum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16AsStringArray, 120), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[120]); + nullableEnum16AsStringArray.SetPropertyIndexes( + index: 120, + originalValueIndex: 120, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5021,6 +7566,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance) == null); + nullableEnum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16AsStringCollection, 121), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[121]); + nullableEnum16AsStringCollection.SetPropertyIndexes( + index: 121, + originalValueIndex: 121, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5079,6 +7645,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance) == null); + nullableEnum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16Collection, 122), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[122]); + nullableEnum16Collection.SetPropertyIndexes( + index: 122, + originalValueIndex: 122, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5138,6 +7725,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32(instance).HasValue); + nullableEnum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32, 123), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32), + (ValueBuffer valueBuffer) => valueBuffer[123]); + nullableEnum32.SetPropertyIndexes( + index: 123, + originalValueIndex: 123, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5166,6 +7774,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance) == null); + nullableEnum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32Array, 124), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32Array), + (ValueBuffer valueBuffer) => valueBuffer[124]); + nullableEnum32Array.SetPropertyIndexes( + index: 124, + originalValueIndex: 124, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5225,6 +7854,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32AsString(instance).HasValue); + nullableEnum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32AsString, 125), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[125]); + nullableEnum32AsString.SetPropertyIndexes( + index: 125, + originalValueIndex: 125, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5253,6 +7903,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance) == null); + nullableEnum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32AsStringArray, 126), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[126]); + nullableEnum32AsStringArray.SetPropertyIndexes( + index: 126, + originalValueIndex: 126, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5311,6 +7982,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance) == null); + nullableEnum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32AsStringCollection, 127), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[127]); + nullableEnum32AsStringCollection.SetPropertyIndexes( + index: 127, + originalValueIndex: 127, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5369,6 +8061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance) == null); + nullableEnum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32Collection, 128), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[128]); + nullableEnum32Collection.SetPropertyIndexes( + index: 128, + originalValueIndex: 128, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5428,6 +8141,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64(instance).HasValue); + nullableEnum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64, 129), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64), + (ValueBuffer valueBuffer) => valueBuffer[129]); + nullableEnum64.SetPropertyIndexes( + index: 129, + originalValueIndex: 129, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5456,6 +8190,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance) == null); + nullableEnum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64Array, 130), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64Array), + (ValueBuffer valueBuffer) => valueBuffer[130]); + nullableEnum64Array.SetPropertyIndexes( + index: 130, + originalValueIndex: 130, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5515,6 +8270,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64AsString(instance).HasValue); + nullableEnum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64AsString, 131), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[131]); + nullableEnum64AsString.SetPropertyIndexes( + index: 131, + originalValueIndex: 131, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsString.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5543,6 +8319,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance) == null); + nullableEnum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64AsStringArray, 132), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[132]); + nullableEnum64AsStringArray.SetPropertyIndexes( + index: 132, + originalValueIndex: 132, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5601,6 +8398,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance) == null); + nullableEnum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64AsStringCollection, 133), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[133]); + nullableEnum64AsStringCollection.SetPropertyIndexes( + index: 133, + originalValueIndex: 133, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5659,6 +8477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance) == null); + nullableEnum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64Collection, 134), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[134]); + nullableEnum64Collection.SetPropertyIndexes( + index: 134, + originalValueIndex: 134, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5718,6 +8557,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8(instance).HasValue); + nullableEnum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8, 135), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8), + (ValueBuffer valueBuffer) => valueBuffer[135]); + nullableEnum8.SetPropertyIndexes( + index: 135, + originalValueIndex: 135, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5746,6 +8606,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance) == null); + nullableEnum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8Array, 136), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8Array), + (ValueBuffer valueBuffer) => valueBuffer[136]); + nullableEnum8Array.SetPropertyIndexes( + index: 136, + originalValueIndex: 136, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5805,6 +8686,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8AsString(instance).HasValue); + nullableEnum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8AsString, 137), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[137]); + nullableEnum8AsString.SetPropertyIndexes( + index: 137, + originalValueIndex: 137, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsString.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5833,6 +8735,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance) == null); + nullableEnum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8AsStringArray, 138), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[138]); + nullableEnum8AsStringArray.SetPropertyIndexes( + index: 138, + originalValueIndex: 138, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5891,6 +8814,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance) == null); + nullableEnum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8AsStringCollection, 139), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[139]); + nullableEnum8AsStringCollection.SetPropertyIndexes( + index: 139, + originalValueIndex: 139, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5949,6 +8893,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance) == null); + nullableEnum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8Collection, 140), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[140]); + nullableEnum8Collection.SetPropertyIndexes( + index: 140, + originalValueIndex: 140, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -6008,6 +8973,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16(instance).HasValue); + nullableEnumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16, 141), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16), + (ValueBuffer valueBuffer) => valueBuffer[141]); + nullableEnumU16.SetPropertyIndexes( + index: 141, + originalValueIndex: 141, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6036,6 +9022,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance) == null); + nullableEnumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16Array, 142), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[142]); + nullableEnumU16Array.SetPropertyIndexes( + index: 142, + originalValueIndex: 142, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6095,6 +9102,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16AsString(instance).HasValue); + nullableEnumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16AsString, 143), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[143]); + nullableEnumU16AsString.SetPropertyIndexes( + index: 143, + originalValueIndex: 143, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6123,6 +9151,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance) == null); + nullableEnumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16AsStringArray, 144), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[144]); + nullableEnumU16AsStringArray.SetPropertyIndexes( + index: 144, + originalValueIndex: 144, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6181,6 +9230,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance) == null); + nullableEnumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16AsStringCollection, 145), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[145]); + nullableEnumU16AsStringCollection.SetPropertyIndexes( + index: 145, + originalValueIndex: 145, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6239,6 +9309,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance) == null); + nullableEnumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16Collection, 146), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[146]); + nullableEnumU16Collection.SetPropertyIndexes( + index: 146, + originalValueIndex: 146, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6298,6 +9389,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32(instance).HasValue); + nullableEnumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32, 147), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32), + (ValueBuffer valueBuffer) => valueBuffer[147]); + nullableEnumU32.SetPropertyIndexes( + index: 147, + originalValueIndex: 147, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6326,6 +9438,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance) == null); + nullableEnumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32Array, 148), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[148]); + nullableEnumU32Array.SetPropertyIndexes( + index: 148, + originalValueIndex: 148, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6385,6 +9518,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32AsString(instance).HasValue); + nullableEnumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32AsString, 149), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[149]); + nullableEnumU32AsString.SetPropertyIndexes( + index: 149, + originalValueIndex: 149, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsString.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6413,6 +9567,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance) == null); + nullableEnumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32AsStringArray, 150), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[150]); + nullableEnumU32AsStringArray.SetPropertyIndexes( + index: 150, + originalValueIndex: 150, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6471,6 +9646,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance) == null); + nullableEnumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32AsStringCollection, 151), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[151]); + nullableEnumU32AsStringCollection.SetPropertyIndexes( + index: 151, + originalValueIndex: 151, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6529,6 +9725,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance) == null); + nullableEnumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32Collection, 152), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[152]); + nullableEnumU32Collection.SetPropertyIndexes( + index: 152, + originalValueIndex: 152, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6588,6 +9805,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64(instance).HasValue); + nullableEnumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64, 153), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64), + (ValueBuffer valueBuffer) => valueBuffer[153]); + nullableEnumU64.SetPropertyIndexes( + index: 153, + originalValueIndex: 153, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6620,6 +9858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance) == null); + nullableEnumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64Array, 154), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[154]); + nullableEnumU64Array.SetPropertyIndexes( + index: 154, + originalValueIndex: 154, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6683,6 +9942,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64AsString(instance).HasValue); + nullableEnumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64AsString, 155), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[155]); + nullableEnumU64AsString.SetPropertyIndexes( + index: 155, + originalValueIndex: 155, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsString.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6715,6 +9995,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance) == null); + nullableEnumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64AsStringArray, 156), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[156]); + nullableEnumU64AsStringArray.SetPropertyIndexes( + index: 156, + originalValueIndex: 156, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6777,6 +10078,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance) == null); + nullableEnumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64AsStringCollection, 157), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[157]); + nullableEnumU64AsStringCollection.SetPropertyIndexes( + index: 157, + originalValueIndex: 157, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6839,6 +10161,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance) == null); + nullableEnumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64Collection, 158), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[158]); + nullableEnumU64Collection.SetPropertyIndexes( + index: 158, + originalValueIndex: 158, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6902,6 +10245,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8(instance).HasValue); + nullableEnumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8, 159), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8), + (ValueBuffer valueBuffer) => valueBuffer[159]); + nullableEnumU8.SetPropertyIndexes( + index: 159, + originalValueIndex: 159, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6930,6 +10294,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance) == null); + nullableEnumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8Array, 160), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[160]); + nullableEnumU8Array.SetPropertyIndexes( + index: 160, + originalValueIndex: 160, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6989,6 +10374,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8AsString(instance).HasValue); + nullableEnumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8AsString, 161), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[161]); + nullableEnumU8AsString.SetPropertyIndexes( + index: 161, + originalValueIndex: 161, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsString.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7017,6 +10423,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance) == null); + nullableEnumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8AsStringArray, 162), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[162]); + nullableEnumU8AsStringArray.SetPropertyIndexes( + index: 162, + originalValueIndex: 162, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7075,6 +10502,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance) == null); + nullableEnumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8AsStringCollection, 163), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[163]); + nullableEnumU8AsStringCollection.SetPropertyIndexes( + index: 163, + originalValueIndex: 163, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7133,6 +10581,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance) == null); + nullableEnumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8Collection, 164), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[164]); + nullableEnumU8Collection.SetPropertyIndexes( + index: 164, + originalValueIndex: 164, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7192,6 +10661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloat", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableFloat.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableFloat(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableFloat(instance).HasValue); + nullableFloat.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableFloat, 165), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableFloat), + (ValueBuffer valueBuffer) => valueBuffer[165]); + nullableFloat.SetPropertyIndexes( + index: 165, + originalValueIndex: 165, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloat.TypeMapping = SqlServerFloatTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -7212,6 +10702,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableFloatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance) == null); + nullableFloatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableFloatArray, 166), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableFloatArray), + (ValueBuffer valueBuffer) => valueBuffer[166]); + nullableFloatArray.SetPropertyIndexes( + index: 166, + originalValueIndex: 166, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloatArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -7255,6 +10766,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableGuid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableGuid(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableGuid(instance).HasValue); + nullableGuid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableGuid, 167), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableGuid), + (ValueBuffer valueBuffer) => valueBuffer[167]); + nullableGuid.SetPropertyIndexes( + index: 167, + originalValueIndex: 167, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuid.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -7277,6 +10809,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableGuidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance) == null); + nullableGuidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableGuidArray, 168), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableGuidArray), + (ValueBuffer valueBuffer) => valueBuffer[168]); + nullableGuidArray.SetPropertyIndexes( + index: 168, + originalValueIndex: 168, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuidArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -7322,6 +10875,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableIPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance) == null); + nullableIPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddress, 169), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddress), + (ValueBuffer valueBuffer) => valueBuffer[169]); + nullableIPAddress.SetPropertyIndexes( + index: 169, + originalValueIndex: 169, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -7355,6 +10929,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableIPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance) == null); + nullableIPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddressArray, 170), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[170]); + nullableIPAddressArray.SetPropertyIndexes( + index: 170, + originalValueIndex: 170, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -7419,6 +11014,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt16(instance).HasValue); + nullableInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt16, 171), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt16), + (ValueBuffer valueBuffer) => valueBuffer[171]); + nullableInt16.SetPropertyIndexes( + index: 171, + originalValueIndex: 171, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -7439,6 +11055,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance) == null); + nullableInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt16Array, 172), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[172]); + nullableInt16Array.SetPropertyIndexes( + index: 172, + originalValueIndex: 172, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -7482,6 +11119,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt32(instance).HasValue); + nullableInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt32, 173), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt32), + (ValueBuffer valueBuffer) => valueBuffer[173]); + nullableInt32.SetPropertyIndexes( + index: 173, + originalValueIndex: 173, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -7502,6 +11160,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance) == null); + nullableInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt32Array, 174), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[174]); + nullableInt32Array.SetPropertyIndexes( + index: 174, + originalValueIndex: 174, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -7545,6 +11224,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt64(instance).HasValue); + nullableInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt64, 175), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt64), + (ValueBuffer valueBuffer) => valueBuffer[175]); + nullableInt64.SetPropertyIndexes( + index: 175, + originalValueIndex: 175, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -7565,6 +11265,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance) == null); + nullableInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt64Array, 176), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[176]); + nullableInt64Array.SetPropertyIndexes( + index: 176, + originalValueIndex: 176, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -7608,6 +11329,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt8(instance).HasValue); + nullableInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt8, 177), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt8), + (ValueBuffer valueBuffer) => valueBuffer[177]); + nullableInt8.SetPropertyIndexes( + index: 177, + originalValueIndex: 177, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -7636,6 +11378,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance) == null); + nullableInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt8Array, 178), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[178]); + nullableInt8Array.SetPropertyIndexes( + index: 178, + originalValueIndex: 178, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -7695,6 +11458,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullablePhysicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance) == null); + nullablePhysicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddress, 179), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[179]); + nullablePhysicalAddress.SetPropertyIndexes( + index: 179, + originalValueIndex: 179, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7728,6 +11512,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullablePhysicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance) == null); + nullablePhysicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddressArray, 180), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[180]); + nullablePhysicalAddressArray.SetPropertyIndexes( + index: 180, + originalValueIndex: 180, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7792,6 +11597,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance) == null); + nullableString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableString, 181), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableString), + (ValueBuffer valueBuffer) => valueBuffer[181]); + nullableString.SetPropertyIndexes( + index: 181, + originalValueIndex: 181, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7817,6 +11643,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance) == null); + nullableStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableStringArray, 182), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableStringArray), + (ValueBuffer valueBuffer) => valueBuffer[182]); + nullableStringArray.SetPropertyIndexes( + index: 182, + originalValueIndex: 182, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7865,6 +11712,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeOnly(instance).HasValue); + nullableTimeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeOnly, 183), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeOnly), + (ValueBuffer valueBuffer) => valueBuffer[183]); + nullableTimeOnly.SetPropertyIndexes( + index: 183, + originalValueIndex: 183, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnly.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -7885,6 +11753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance) == null); + nullableTimeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeOnlyArray, 184), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[184]); + nullableTimeOnlyArray.SetPropertyIndexes( + index: 184, + originalValueIndex: 184, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -7928,6 +11817,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeSpan(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeSpan(instance).HasValue); + nullableTimeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeSpan, 185), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeSpan), + (ValueBuffer valueBuffer) => valueBuffer[185]); + nullableTimeSpan.SetPropertyIndexes( + index: 185, + originalValueIndex: 185, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpan.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -7948,6 +11858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance) == null); + nullableTimeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeSpanArray, 186), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[186]); + nullableTimeSpanArray.SetPropertyIndexes( + index: 186, + originalValueIndex: 186, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpanArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -7991,6 +11922,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt16(instance).HasValue); + nullableUInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt16, 187), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt16), + (ValueBuffer valueBuffer) => valueBuffer[187]); + nullableUInt16.SetPropertyIndexes( + index: 187, + originalValueIndex: 187, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -8019,6 +11971,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance) == null); + nullableUInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt16Array, 188), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[188]); + nullableUInt16Array.SetPropertyIndexes( + index: 188, + originalValueIndex: 188, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -8078,6 +12051,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt32(instance).HasValue); + nullableUInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt32, 189), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt32), + (ValueBuffer valueBuffer) => valueBuffer[189]); + nullableUInt32.SetPropertyIndexes( + index: 189, + originalValueIndex: 189, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -8106,6 +12100,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance) == null); + nullableUInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt32Array, 190), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[190]); + nullableUInt32Array.SetPropertyIndexes( + index: 190, + originalValueIndex: 190, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -8165,6 +12180,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt64(instance).HasValue); + nullableUInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt64, 191), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt64), + (ValueBuffer valueBuffer) => valueBuffer[191]); + nullableUInt64.SetPropertyIndexes( + index: 191, + originalValueIndex: 191, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -8197,6 +12233,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance) == null); + nullableUInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt64Array, 192), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[192]); + nullableUInt64Array.SetPropertyIndexes( + index: 192, + originalValueIndex: 192, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -8260,6 +12317,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt8(instance).HasValue); + nullableUInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt8, 193), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt8), + (ValueBuffer valueBuffer) => valueBuffer[193]); + nullableUInt8.SetPropertyIndexes( + index: 193, + originalValueIndex: 193, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -8280,6 +12358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance) == null); + nullableUInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt8Array, 194), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[194]); + nullableUInt8Array.SetPropertyIndexes( + index: 194, + originalValueIndex: 194, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -8323,6 +12422,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance) == null); + nullableUri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUri, 195), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUri), + (ValueBuffer valueBuffer) => valueBuffer[195]); + nullableUri.SetPropertyIndexes( + index: 195, + originalValueIndex: 195, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUri.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8356,6 +12476,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance) == null); + nullableUriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUriArray, 196), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUriArray), + (ValueBuffer valueBuffer) => valueBuffer[196]); + nullableUriArray.SetPropertyIndexes( + index: 196, + originalValueIndex: 196, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUriArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8419,6 +12560,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance) == null); + physicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddress, 197), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[197]); + physicalAddress.SetPropertyIndexes( + index: 197, + originalValueIndex: 197, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8452,6 +12614,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance) == null); + physicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressArray, 198), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[198]); + physicalAddressArray.SetPropertyIndexes( + index: 198, + originalValueIndex: 198, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8516,6 +12699,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToBytesConverter()); + physicalAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance) == null); + physicalAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToBytesConverterProperty, 199), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[199]); + physicalAddressToBytesConverterProperty.SetPropertyIndexes( + index: 199, + originalValueIndex: 199, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8526,20 +12730,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (PhysicalAddress v) => v.GetHashCode(), (PhysicalAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(8)", size: 8), converter: new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)), + (byte[] v) => new PhysicalAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)))); + (byte[] v) => new PhysicalAddress(v)))); physicalAddressToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var physicalAddressToStringConverterProperty = runtimeEntityType.AddProperty( @@ -8548,6 +12752,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToStringConverter()); + physicalAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance) == null); + physicalAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToStringConverterProperty, 200), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[200]); + physicalAddressToStringConverterProperty.SetPropertyIndexes( + index: 200, + originalValueIndex: 200, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8581,6 +12806,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("String", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @string.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance) == null); + @string.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetAccessors( + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@string, 201), + (InternalEntityEntry entry) => entry.GetCurrentValue(@string), + (ValueBuffer valueBuffer) => valueBuffer[201]); + @string.SetPropertyIndexes( + index: 201, + originalValueIndex: 201, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @string.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8606,6 +12852,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance) == null); + stringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetAccessors( + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringArray, 202), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringArray), + (ValueBuffer valueBuffer) => valueBuffer[202]); + stringArray.SetPropertyIndexes( + index: 202, + originalValueIndex: 202, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8654,6 +12921,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBoolConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToBoolConverter()); + stringToBoolConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance) == null); + stringToBoolConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBoolConverterProperty, 203), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBoolConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[203]); + stringToBoolConverterProperty.SetPropertyIndexes( + index: 203, + originalValueIndex: 203, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBoolConverterProperty.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8683,6 +12971,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + stringToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance) == null); + stringToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBytesConverterProperty, 204), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[204]); + stringToBytesConverterProperty.SetPropertyIndexes( + index: 204, + originalValueIndex: 204, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8693,20 +13002,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), converter: new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)), + (byte[] v) => Encoding.UTF32.GetString(v)), storeTypePostfix: StoreTypePostfix.None, jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)))); + (byte[] v) => Encoding.UTF32.GetString(v)))); stringToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var stringToCharConverterProperty = runtimeEntityType.AddProperty( @@ -8715,6 +13024,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToCharConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToCharConverter()); + stringToCharConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance) == null); + stringToCharConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToCharConverterProperty, 205), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToCharConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[205]); + stringToCharConverterProperty.SetPropertyIndexes( + index: 205, + originalValueIndex: 205, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToCharConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8749,6 +13079,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateOnlyConverter()); + stringToDateOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance) == null); + stringToDateOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateOnlyConverterProperty, 206), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[206]); + stringToDateOnlyConverterProperty.SetPropertyIndexes( + index: 206, + originalValueIndex: 206, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateOnlyConverterProperty.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8780,6 +13131,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeConverter()); + stringToDateTimeConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance) == null); + stringToDateTimeConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeConverterProperty, 207), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[207]); + stringToDateTimeConverterProperty.SetPropertyIndexes( + index: 207, + originalValueIndex: 207, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeConverterProperty.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8811,6 +13183,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeOffsetConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeOffsetConverter()); + stringToDateTimeOffsetConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance) == null); + stringToDateTimeOffsetConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeOffsetConverterProperty, 208), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeOffsetConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[208]); + stringToDateTimeOffsetConverterProperty.SetPropertyIndexes( + index: 208, + originalValueIndex: 208, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeOffsetConverterProperty.TypeMapping = SqlServerDateTimeOffsetTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8842,6 +13235,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDecimalNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDecimalNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance) == null); + stringToDecimalNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDecimalNumberConverterProperty, 209), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDecimalNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[209]); + stringToDecimalNumberConverterProperty.SetPropertyIndexes( + index: 209, + originalValueIndex: 209, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDecimalNumberConverterProperty.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8873,6 +13287,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDoubleNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDoubleNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance) == null); + stringToDoubleNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDoubleNumberConverterProperty, 210), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDoubleNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[210]); + stringToDoubleNumberConverterProperty.SetPropertyIndexes( + index: 210, + originalValueIndex: 210, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDoubleNumberConverterProperty.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8904,6 +13339,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToEnumConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToEnumConverter()); + stringToEnumConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance) == null); + stringToEnumConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToEnumConverterProperty, 211), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToEnumConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[211]); + stringToEnumConverterProperty.SetPropertyIndexes( + index: 211, + originalValueIndex: 211, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToEnumConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8932,6 +13388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToGuidConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringToGuidConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance) == null); + stringToGuidConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToGuidConverterProperty, 212), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToGuidConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[212]); + stringToGuidConverterProperty.SetPropertyIndexes( + index: 212, + originalValueIndex: 212, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToGuidConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8958,6 +13435,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToIntNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToIntNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance) == null); + stringToIntNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToIntNumberConverterProperty, 213), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToIntNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[213]); + stringToIntNumberConverterProperty.SetPropertyIndexes( + index: 213, + originalValueIndex: 213, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToIntNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8989,6 +13487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeOnlyConverter()); + stringToTimeOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance) == null); + stringToTimeOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeOnlyConverterProperty, 214), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[214]); + stringToTimeOnlyConverterProperty.SetPropertyIndexes( + index: 214, + originalValueIndex: 214, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeOnlyConverterProperty.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9020,6 +13539,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeSpanConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeSpanConverter()); + stringToTimeSpanConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance) == null); + stringToTimeSpanConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeSpanConverterProperty, 215), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeSpanConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[215]); + stringToTimeSpanConverterProperty.SetPropertyIndexes( + index: 215, + originalValueIndex: 215, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeSpanConverterProperty.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9051,6 +13591,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToUriConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToUriConverter()); + stringToUriConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance) == null); + stringToUriConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToUriConverterProperty, 216), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToUriConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[216]); + stringToUriConverterProperty.SetPropertyIndexes( + index: 216, + originalValueIndex: 216, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToUriConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9085,6 +13646,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeOnly(0, 0, 0)); + timeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance) == default(TimeOnly)); + timeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnly, 217), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnly), + (ValueBuffer valueBuffer) => valueBuffer[217]); + timeOnly.SetPropertyIndexes( + index: 217, + originalValueIndex: 217, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnly.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9105,6 +13687,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance) == null); + timeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyArray, 218), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[218]); + timeOnlyArray.SetPropertyIndexes( + index: 218, + originalValueIndex: 218, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9148,6 +13751,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToStringConverter()); + timeOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance) == default(TimeOnly)); + timeOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToStringConverterProperty, 219), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[219]); + timeOnlyToStringConverterProperty.SetPropertyIndexes( + index: 219, + originalValueIndex: 219, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9183,6 +13807,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToTicksConverter()); + timeOnlyToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance) == default(TimeOnly)); + timeOnlyToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToTicksConverterProperty, 220), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[220]); + timeOnlyToTicksConverterProperty.SetPropertyIndexes( + index: 220, + originalValueIndex: 220, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToTicksConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9213,6 +13858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeSpan(0, 0, 0, 0, 0)); + timeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance) == default(TimeSpan)); + timeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpan, 221), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpan), + (ValueBuffer valueBuffer) => valueBuffer[221]); + timeSpan.SetPropertyIndexes( + index: 221, + originalValueIndex: 221, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpan.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9233,6 +13899,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance) == null); + timeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanArray, 222), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[222]); + timeSpanArray.SetPropertyIndexes( + index: 222, + originalValueIndex: 222, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9276,6 +13963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToStringConverter()); + timeSpanToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance) == default(TimeSpan)); + timeSpanToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToStringConverterProperty, 223), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[223]); + timeSpanToStringConverterProperty.SetPropertyIndexes( + index: 223, + originalValueIndex: 223, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9311,6 +14019,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToTicksConverter()); + timeSpanToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance) == default(TimeSpan)); + timeSpanToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToTicksConverterProperty, 224), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[224]); + timeSpanToTicksConverterProperty.SetPropertyIndexes( + index: 224, + originalValueIndex: 224, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToTicksConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9340,6 +14069,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance) == 0); + uInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16, 225), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16), + (ValueBuffer valueBuffer) => valueBuffer[225]); + uInt16.SetPropertyIndexes( + index: 225, + originalValueIndex: 225, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -9369,6 +14119,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance) == null); + uInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16Array, 226), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[226]); + uInt16Array.SetPropertyIndexes( + index: 226, + originalValueIndex: 226, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -9427,6 +14198,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity) == 0U, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance) == 0U); + uInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32, 227), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32), + (ValueBuffer valueBuffer) => valueBuffer[227]); + uInt32.SetPropertyIndexes( + index: 227, + originalValueIndex: 227, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -9456,6 +14248,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance) == null); + uInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32Array, 228), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[228]); + uInt32Array.SetPropertyIndexes( + index: 228, + originalValueIndex: 228, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -9514,6 +14327,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity) == 0UL, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance) == 0UL); + uInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64, 229), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64), + (ValueBuffer valueBuffer) => valueBuffer[229]); + uInt64.SetPropertyIndexes( + index: 229, + originalValueIndex: 229, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -9547,6 +14381,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance) == null); + uInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64Array, 230), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[230]); + uInt64Array.SetPropertyIndexes( + index: 230, + originalValueIndex: 230, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -9610,6 +14465,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (byte)0); + uInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance) == 0); + uInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8, 231), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8), + (ValueBuffer valueBuffer) => valueBuffer[231]); + uInt8.SetPropertyIndexes( + index: 231, + originalValueIndex: 231, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -9630,19 +14506,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance) == null); + uInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8Array, 232), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[232]); + uInt8Array.SetPropertyIndexes( + index: 232, + originalValueIndex: 232, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8Array.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -9653,6 +14550,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Uri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance) == null); + uri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetAccessors( + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uri, 233), + (InternalEntityEntry entry) => entry.GetCurrentValue(uri), + (ValueBuffer valueBuffer) => valueBuffer[233]); + uri.SetPropertyIndexes( + index: 233, + originalValueIndex: 233, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uri.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9686,6 +14604,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance) == null); + uriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetAccessors( + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriArray, 234), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriArray), + (ValueBuffer valueBuffer) => valueBuffer[234]); + uriArray.SetPropertyIndexes( + index: 234, + originalValueIndex: 234, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9750,6 +14689,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new UriToStringConverter()); + uriToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance) == null); + uriToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriToStringConverterProperty, 235), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[235]); + uriToStringConverterProperty.SetPropertyIndexes( + index: 235, + originalValueIndex: 235, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9787,6 +14747,284 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var @bool = runtimeEntityType.FindProperty("Bool")!; + var boolArray = runtimeEntityType.FindProperty("BoolArray")!; + var boolToStringConverterProperty = runtimeEntityType.FindProperty("BoolToStringConverterProperty")!; + var boolToTwoValuesConverterProperty = runtimeEntityType.FindProperty("BoolToTwoValuesConverterProperty")!; + var boolToZeroOneConverterProperty = runtimeEntityType.FindProperty("BoolToZeroOneConverterProperty")!; + var bytes = runtimeEntityType.FindProperty("Bytes")!; + var bytesArray = runtimeEntityType.FindProperty("BytesArray")!; + var bytesToStringConverterProperty = runtimeEntityType.FindProperty("BytesToStringConverterProperty")!; + var castingConverterProperty = runtimeEntityType.FindProperty("CastingConverterProperty")!; + var @char = runtimeEntityType.FindProperty("Char")!; + var charArray = runtimeEntityType.FindProperty("CharArray")!; + var charToStringConverterProperty = runtimeEntityType.FindProperty("CharToStringConverterProperty")!; + var dateOnly = runtimeEntityType.FindProperty("DateOnly")!; + var dateOnlyArray = runtimeEntityType.FindProperty("DateOnlyArray")!; + var dateOnlyToStringConverterProperty = runtimeEntityType.FindProperty("DateOnlyToStringConverterProperty")!; + var dateTime = runtimeEntityType.FindProperty("DateTime")!; + var dateTimeArray = runtimeEntityType.FindProperty("DateTimeArray")!; + var dateTimeOffsetToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBinaryConverterProperty")!; + var dateTimeOffsetToBytesConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBytesConverterProperty")!; + var dateTimeOffsetToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToStringConverterProperty")!; + var dateTimeToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeToBinaryConverterProperty")!; + var dateTimeToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeToStringConverterProperty")!; + var dateTimeToTicksConverterProperty = runtimeEntityType.FindProperty("DateTimeToTicksConverterProperty")!; + var @decimal = runtimeEntityType.FindProperty("Decimal")!; + var decimalArray = runtimeEntityType.FindProperty("DecimalArray")!; + var decimalNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToBytesConverterProperty")!; + var decimalNumberToStringConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToStringConverterProperty")!; + var @double = runtimeEntityType.FindProperty("Double")!; + var doubleArray = runtimeEntityType.FindProperty("DoubleArray")!; + var doubleNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToBytesConverterProperty")!; + var doubleNumberToStringConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToStringConverterProperty")!; + var enum16 = runtimeEntityType.FindProperty("Enum16")!; + var enum16Array = runtimeEntityType.FindProperty("Enum16Array")!; + var enum16AsString = runtimeEntityType.FindProperty("Enum16AsString")!; + var enum16AsStringArray = runtimeEntityType.FindProperty("Enum16AsStringArray")!; + var enum16AsStringCollection = runtimeEntityType.FindProperty("Enum16AsStringCollection")!; + var enum16Collection = runtimeEntityType.FindProperty("Enum16Collection")!; + var enum32 = runtimeEntityType.FindProperty("Enum32")!; + var enum32Array = runtimeEntityType.FindProperty("Enum32Array")!; + var enum32AsString = runtimeEntityType.FindProperty("Enum32AsString")!; + var enum32AsStringArray = runtimeEntityType.FindProperty("Enum32AsStringArray")!; + var enum32AsStringCollection = runtimeEntityType.FindProperty("Enum32AsStringCollection")!; + var enum32Collection = runtimeEntityType.FindProperty("Enum32Collection")!; + var enum64 = runtimeEntityType.FindProperty("Enum64")!; + var enum64Array = runtimeEntityType.FindProperty("Enum64Array")!; + var enum64AsString = runtimeEntityType.FindProperty("Enum64AsString")!; + var enum64AsStringArray = runtimeEntityType.FindProperty("Enum64AsStringArray")!; + var enum64AsStringCollection = runtimeEntityType.FindProperty("Enum64AsStringCollection")!; + var enum64Collection = runtimeEntityType.FindProperty("Enum64Collection")!; + var enum8 = runtimeEntityType.FindProperty("Enum8")!; + var enum8Array = runtimeEntityType.FindProperty("Enum8Array")!; + var enum8AsString = runtimeEntityType.FindProperty("Enum8AsString")!; + var enum8AsStringArray = runtimeEntityType.FindProperty("Enum8AsStringArray")!; + var enum8AsStringCollection = runtimeEntityType.FindProperty("Enum8AsStringCollection")!; + var enum8Collection = runtimeEntityType.FindProperty("Enum8Collection")!; + var enumToNumberConverterProperty = runtimeEntityType.FindProperty("EnumToNumberConverterProperty")!; + var enumToStringConverterProperty = runtimeEntityType.FindProperty("EnumToStringConverterProperty")!; + var enumU16 = runtimeEntityType.FindProperty("EnumU16")!; + var enumU16Array = runtimeEntityType.FindProperty("EnumU16Array")!; + var enumU16AsString = runtimeEntityType.FindProperty("EnumU16AsString")!; + var enumU16AsStringArray = runtimeEntityType.FindProperty("EnumU16AsStringArray")!; + var enumU16AsStringCollection = runtimeEntityType.FindProperty("EnumU16AsStringCollection")!; + var enumU16Collection = runtimeEntityType.FindProperty("EnumU16Collection")!; + var enumU32 = runtimeEntityType.FindProperty("EnumU32")!; + var enumU32Array = runtimeEntityType.FindProperty("EnumU32Array")!; + var enumU32AsString = runtimeEntityType.FindProperty("EnumU32AsString")!; + var enumU32AsStringArray = runtimeEntityType.FindProperty("EnumU32AsStringArray")!; + var enumU32AsStringCollection = runtimeEntityType.FindProperty("EnumU32AsStringCollection")!; + var enumU32Collection = runtimeEntityType.FindProperty("EnumU32Collection")!; + var enumU64 = runtimeEntityType.FindProperty("EnumU64")!; + var enumU64Array = runtimeEntityType.FindProperty("EnumU64Array")!; + var enumU64AsString = runtimeEntityType.FindProperty("EnumU64AsString")!; + var enumU64AsStringArray = runtimeEntityType.FindProperty("EnumU64AsStringArray")!; + var enumU64AsStringCollection = runtimeEntityType.FindProperty("EnumU64AsStringCollection")!; + var enumU64Collection = runtimeEntityType.FindProperty("EnumU64Collection")!; + var enumU8 = runtimeEntityType.FindProperty("EnumU8")!; + var enumU8Array = runtimeEntityType.FindProperty("EnumU8Array")!; + var enumU8AsString = runtimeEntityType.FindProperty("EnumU8AsString")!; + var enumU8AsStringArray = runtimeEntityType.FindProperty("EnumU8AsStringArray")!; + var enumU8AsStringCollection = runtimeEntityType.FindProperty("EnumU8AsStringCollection")!; + var enumU8Collection = runtimeEntityType.FindProperty("EnumU8Collection")!; + var @float = runtimeEntityType.FindProperty("Float")!; + var floatArray = runtimeEntityType.FindProperty("FloatArray")!; + var guid = runtimeEntityType.FindProperty("Guid")!; + var guidArray = runtimeEntityType.FindProperty("GuidArray")!; + var guidToBytesConverterProperty = runtimeEntityType.FindProperty("GuidToBytesConverterProperty")!; + var guidToStringConverterProperty = runtimeEntityType.FindProperty("GuidToStringConverterProperty")!; + var iPAddress = runtimeEntityType.FindProperty("IPAddress")!; + var iPAddressArray = runtimeEntityType.FindProperty("IPAddressArray")!; + var iPAddressToBytesConverterProperty = runtimeEntityType.FindProperty("IPAddressToBytesConverterProperty")!; + var iPAddressToStringConverterProperty = runtimeEntityType.FindProperty("IPAddressToStringConverterProperty")!; + var int16 = runtimeEntityType.FindProperty("Int16")!; + var int16Array = runtimeEntityType.FindProperty("Int16Array")!; + var int32 = runtimeEntityType.FindProperty("Int32")!; + var int32Array = runtimeEntityType.FindProperty("Int32Array")!; + var int64 = runtimeEntityType.FindProperty("Int64")!; + var int64Array = runtimeEntityType.FindProperty("Int64Array")!; + var int8 = runtimeEntityType.FindProperty("Int8")!; + var int8Array = runtimeEntityType.FindProperty("Int8Array")!; + var intNumberToBytesConverterProperty = runtimeEntityType.FindProperty("IntNumberToBytesConverterProperty")!; + var intNumberToStringConverterProperty = runtimeEntityType.FindProperty("IntNumberToStringConverterProperty")!; + var nullIntToNullStringConverterProperty = runtimeEntityType.FindProperty("NullIntToNullStringConverterProperty")!; + var nullableBool = runtimeEntityType.FindProperty("NullableBool")!; + var nullableBoolArray = runtimeEntityType.FindProperty("NullableBoolArray")!; + var nullableBytes = runtimeEntityType.FindProperty("NullableBytes")!; + var nullableBytesArray = runtimeEntityType.FindProperty("NullableBytesArray")!; + var nullableChar = runtimeEntityType.FindProperty("NullableChar")!; + var nullableCharArray = runtimeEntityType.FindProperty("NullableCharArray")!; + var nullableDateOnly = runtimeEntityType.FindProperty("NullableDateOnly")!; + var nullableDateOnlyArray = runtimeEntityType.FindProperty("NullableDateOnlyArray")!; + var nullableDateTime = runtimeEntityType.FindProperty("NullableDateTime")!; + var nullableDateTimeArray = runtimeEntityType.FindProperty("NullableDateTimeArray")!; + var nullableDecimal = runtimeEntityType.FindProperty("NullableDecimal")!; + var nullableDecimalArray = runtimeEntityType.FindProperty("NullableDecimalArray")!; + var nullableDouble = runtimeEntityType.FindProperty("NullableDouble")!; + var nullableDoubleArray = runtimeEntityType.FindProperty("NullableDoubleArray")!; + var nullableEnum16 = runtimeEntityType.FindProperty("NullableEnum16")!; + var nullableEnum16Array = runtimeEntityType.FindProperty("NullableEnum16Array")!; + var nullableEnum16AsString = runtimeEntityType.FindProperty("NullableEnum16AsString")!; + var nullableEnum16AsStringArray = runtimeEntityType.FindProperty("NullableEnum16AsStringArray")!; + var nullableEnum16AsStringCollection = runtimeEntityType.FindProperty("NullableEnum16AsStringCollection")!; + var nullableEnum16Collection = runtimeEntityType.FindProperty("NullableEnum16Collection")!; + var nullableEnum32 = runtimeEntityType.FindProperty("NullableEnum32")!; + var nullableEnum32Array = runtimeEntityType.FindProperty("NullableEnum32Array")!; + var nullableEnum32AsString = runtimeEntityType.FindProperty("NullableEnum32AsString")!; + var nullableEnum32AsStringArray = runtimeEntityType.FindProperty("NullableEnum32AsStringArray")!; + var nullableEnum32AsStringCollection = runtimeEntityType.FindProperty("NullableEnum32AsStringCollection")!; + var nullableEnum32Collection = runtimeEntityType.FindProperty("NullableEnum32Collection")!; + var nullableEnum64 = runtimeEntityType.FindProperty("NullableEnum64")!; + var nullableEnum64Array = runtimeEntityType.FindProperty("NullableEnum64Array")!; + var nullableEnum64AsString = runtimeEntityType.FindProperty("NullableEnum64AsString")!; + var nullableEnum64AsStringArray = runtimeEntityType.FindProperty("NullableEnum64AsStringArray")!; + var nullableEnum64AsStringCollection = runtimeEntityType.FindProperty("NullableEnum64AsStringCollection")!; + var nullableEnum64Collection = runtimeEntityType.FindProperty("NullableEnum64Collection")!; + var nullableEnum8 = runtimeEntityType.FindProperty("NullableEnum8")!; + var nullableEnum8Array = runtimeEntityType.FindProperty("NullableEnum8Array")!; + var nullableEnum8AsString = runtimeEntityType.FindProperty("NullableEnum8AsString")!; + var nullableEnum8AsStringArray = runtimeEntityType.FindProperty("NullableEnum8AsStringArray")!; + var nullableEnum8AsStringCollection = runtimeEntityType.FindProperty("NullableEnum8AsStringCollection")!; + var nullableEnum8Collection = runtimeEntityType.FindProperty("NullableEnum8Collection")!; + var nullableEnumU16 = runtimeEntityType.FindProperty("NullableEnumU16")!; + var nullableEnumU16Array = runtimeEntityType.FindProperty("NullableEnumU16Array")!; + var nullableEnumU16AsString = runtimeEntityType.FindProperty("NullableEnumU16AsString")!; + var nullableEnumU16AsStringArray = runtimeEntityType.FindProperty("NullableEnumU16AsStringArray")!; + var nullableEnumU16AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU16AsStringCollection")!; + var nullableEnumU16Collection = runtimeEntityType.FindProperty("NullableEnumU16Collection")!; + var nullableEnumU32 = runtimeEntityType.FindProperty("NullableEnumU32")!; + var nullableEnumU32Array = runtimeEntityType.FindProperty("NullableEnumU32Array")!; + var nullableEnumU32AsString = runtimeEntityType.FindProperty("NullableEnumU32AsString")!; + var nullableEnumU32AsStringArray = runtimeEntityType.FindProperty("NullableEnumU32AsStringArray")!; + var nullableEnumU32AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU32AsStringCollection")!; + var nullableEnumU32Collection = runtimeEntityType.FindProperty("NullableEnumU32Collection")!; + var nullableEnumU64 = runtimeEntityType.FindProperty("NullableEnumU64")!; + var nullableEnumU64Array = runtimeEntityType.FindProperty("NullableEnumU64Array")!; + var nullableEnumU64AsString = runtimeEntityType.FindProperty("NullableEnumU64AsString")!; + var nullableEnumU64AsStringArray = runtimeEntityType.FindProperty("NullableEnumU64AsStringArray")!; + var nullableEnumU64AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU64AsStringCollection")!; + var nullableEnumU64Collection = runtimeEntityType.FindProperty("NullableEnumU64Collection")!; + var nullableEnumU8 = runtimeEntityType.FindProperty("NullableEnumU8")!; + var nullableEnumU8Array = runtimeEntityType.FindProperty("NullableEnumU8Array")!; + var nullableEnumU8AsString = runtimeEntityType.FindProperty("NullableEnumU8AsString")!; + var nullableEnumU8AsStringArray = runtimeEntityType.FindProperty("NullableEnumU8AsStringArray")!; + var nullableEnumU8AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU8AsStringCollection")!; + var nullableEnumU8Collection = runtimeEntityType.FindProperty("NullableEnumU8Collection")!; + var nullableFloat = runtimeEntityType.FindProperty("NullableFloat")!; + var nullableFloatArray = runtimeEntityType.FindProperty("NullableFloatArray")!; + var nullableGuid = runtimeEntityType.FindProperty("NullableGuid")!; + var nullableGuidArray = runtimeEntityType.FindProperty("NullableGuidArray")!; + var nullableIPAddress = runtimeEntityType.FindProperty("NullableIPAddress")!; + var nullableIPAddressArray = runtimeEntityType.FindProperty("NullableIPAddressArray")!; + var nullableInt16 = runtimeEntityType.FindProperty("NullableInt16")!; + var nullableInt16Array = runtimeEntityType.FindProperty("NullableInt16Array")!; + var nullableInt32 = runtimeEntityType.FindProperty("NullableInt32")!; + var nullableInt32Array = runtimeEntityType.FindProperty("NullableInt32Array")!; + var nullableInt64 = runtimeEntityType.FindProperty("NullableInt64")!; + var nullableInt64Array = runtimeEntityType.FindProperty("NullableInt64Array")!; + var nullableInt8 = runtimeEntityType.FindProperty("NullableInt8")!; + var nullableInt8Array = runtimeEntityType.FindProperty("NullableInt8Array")!; + var nullablePhysicalAddress = runtimeEntityType.FindProperty("NullablePhysicalAddress")!; + var nullablePhysicalAddressArray = runtimeEntityType.FindProperty("NullablePhysicalAddressArray")!; + var nullableString = runtimeEntityType.FindProperty("NullableString")!; + var nullableStringArray = runtimeEntityType.FindProperty("NullableStringArray")!; + var nullableTimeOnly = runtimeEntityType.FindProperty("NullableTimeOnly")!; + var nullableTimeOnlyArray = runtimeEntityType.FindProperty("NullableTimeOnlyArray")!; + var nullableTimeSpan = runtimeEntityType.FindProperty("NullableTimeSpan")!; + var nullableTimeSpanArray = runtimeEntityType.FindProperty("NullableTimeSpanArray")!; + var nullableUInt16 = runtimeEntityType.FindProperty("NullableUInt16")!; + var nullableUInt16Array = runtimeEntityType.FindProperty("NullableUInt16Array")!; + var nullableUInt32 = runtimeEntityType.FindProperty("NullableUInt32")!; + var nullableUInt32Array = runtimeEntityType.FindProperty("NullableUInt32Array")!; + var nullableUInt64 = runtimeEntityType.FindProperty("NullableUInt64")!; + var nullableUInt64Array = runtimeEntityType.FindProperty("NullableUInt64Array")!; + var nullableUInt8 = runtimeEntityType.FindProperty("NullableUInt8")!; + var nullableUInt8Array = runtimeEntityType.FindProperty("NullableUInt8Array")!; + var nullableUri = runtimeEntityType.FindProperty("NullableUri")!; + var nullableUriArray = runtimeEntityType.FindProperty("NullableUriArray")!; + var physicalAddress = runtimeEntityType.FindProperty("PhysicalAddress")!; + var physicalAddressArray = runtimeEntityType.FindProperty("PhysicalAddressArray")!; + var physicalAddressToBytesConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToBytesConverterProperty")!; + var physicalAddressToStringConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToStringConverterProperty")!; + var @string = runtimeEntityType.FindProperty("String")!; + var stringArray = runtimeEntityType.FindProperty("StringArray")!; + var stringToBoolConverterProperty = runtimeEntityType.FindProperty("StringToBoolConverterProperty")!; + var stringToBytesConverterProperty = runtimeEntityType.FindProperty("StringToBytesConverterProperty")!; + var stringToCharConverterProperty = runtimeEntityType.FindProperty("StringToCharConverterProperty")!; + var stringToDateOnlyConverterProperty = runtimeEntityType.FindProperty("StringToDateOnlyConverterProperty")!; + var stringToDateTimeConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeConverterProperty")!; + var stringToDateTimeOffsetConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeOffsetConverterProperty")!; + var stringToDecimalNumberConverterProperty = runtimeEntityType.FindProperty("StringToDecimalNumberConverterProperty")!; + var stringToDoubleNumberConverterProperty = runtimeEntityType.FindProperty("StringToDoubleNumberConverterProperty")!; + var stringToEnumConverterProperty = runtimeEntityType.FindProperty("StringToEnumConverterProperty")!; + var stringToGuidConverterProperty = runtimeEntityType.FindProperty("StringToGuidConverterProperty")!; + var stringToIntNumberConverterProperty = runtimeEntityType.FindProperty("StringToIntNumberConverterProperty")!; + var stringToTimeOnlyConverterProperty = runtimeEntityType.FindProperty("StringToTimeOnlyConverterProperty")!; + var stringToTimeSpanConverterProperty = runtimeEntityType.FindProperty("StringToTimeSpanConverterProperty")!; + var stringToUriConverterProperty = runtimeEntityType.FindProperty("StringToUriConverterProperty")!; + var timeOnly = runtimeEntityType.FindProperty("TimeOnly")!; + var timeOnlyArray = runtimeEntityType.FindProperty("TimeOnlyArray")!; + var timeOnlyToStringConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToStringConverterProperty")!; + var timeOnlyToTicksConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToTicksConverterProperty")!; + var timeSpan = runtimeEntityType.FindProperty("TimeSpan")!; + var timeSpanArray = runtimeEntityType.FindProperty("TimeSpanArray")!; + var timeSpanToStringConverterProperty = runtimeEntityType.FindProperty("TimeSpanToStringConverterProperty")!; + var timeSpanToTicksConverterProperty = runtimeEntityType.FindProperty("TimeSpanToTicksConverterProperty")!; + var uInt16 = runtimeEntityType.FindProperty("UInt16")!; + var uInt16Array = runtimeEntityType.FindProperty("UInt16Array")!; + var uInt32 = runtimeEntityType.FindProperty("UInt32")!; + var uInt32Array = runtimeEntityType.FindProperty("UInt32Array")!; + var uInt64 = runtimeEntityType.FindProperty("UInt64")!; + var uInt64Array = runtimeEntityType.FindProperty("UInt64Array")!; + var uInt8 = runtimeEntityType.FindProperty("UInt8")!; + var uInt8Array = runtimeEntityType.FindProperty("UInt8Array")!; + var uri = runtimeEntityType.FindProperty("Uri")!; + var uriArray = runtimeEntityType.FindProperty("UriArray")!; + var uriToStringConverterProperty = runtimeEntityType.FindProperty("UriToStringConverterProperty")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg = (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)@bool.GetValueComparer()).Snapshot(source.GetCurrentValue(@bool)), (IEnumerable)source.GetCurrentValue(boolArray) == null ? null : (bool[])((ValueComparer>)boolArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(boolArray)), ((ValueComparer)boolToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToStringConverterProperty)), ((ValueComparer)boolToTwoValuesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToTwoValuesConverterProperty)), ((ValueComparer)boolToZeroOneConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToZeroOneConverterProperty)), source.GetCurrentValue(bytes) == null ? null : ((ValueComparer)bytes.GetValueComparer()).Snapshot(source.GetCurrentValue(bytes)), (IEnumerable)source.GetCurrentValue(bytesArray) == null ? null : (byte[][])((ValueComparer>)bytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(bytesArray)), source.GetCurrentValue(bytesToStringConverterProperty) == null ? null : ((ValueComparer)bytesToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(bytesToStringConverterProperty)), ((ValueComparer)castingConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(castingConverterProperty)), ((ValueComparer)@char.GetValueComparer()).Snapshot(source.GetCurrentValue(@char)), (IEnumerable)source.GetCurrentValue(charArray) == null ? null : (char[])((ValueComparer>)charArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(charArray)), ((ValueComparer)charToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(charToStringConverterProperty)), ((ValueComparer)dateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnly)), (IEnumerable)source.GetCurrentValue(dateOnlyArray) == null ? null : (DateOnly[])((ValueComparer>)dateOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateOnlyArray)), ((ValueComparer)dateOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnlyToStringConverterProperty)), ((ValueComparer)dateTime.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTime)), (IEnumerable)source.GetCurrentValue(dateTimeArray) == null ? null : (DateTime[])((ValueComparer>)dateTimeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateTimeArray)), ((ValueComparer)dateTimeOffsetToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty)), ((ValueComparer)dateTimeOffsetToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBytesConverterProperty)), ((ValueComparer)dateTimeOffsetToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToStringConverterProperty)), ((ValueComparer)dateTimeToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToBinaryConverterProperty)), ((ValueComparer)dateTimeToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToStringConverterProperty)), ((ValueComparer)dateTimeToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToTicksConverterProperty)), ((ValueComparer)@decimal.GetValueComparer()).Snapshot(source.GetCurrentValue(@decimal)), (IEnumerable)source.GetCurrentValue(decimalArray) == null ? null : (decimal[])((ValueComparer>)decimalArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(decimalArray)), ((ValueComparer)decimalNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToBytesConverterProperty)), ((ValueComparer)decimalNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToStringConverterProperty)), ((ValueComparer)@double.GetValueComparer()).Snapshot(source.GetCurrentValue(@double)), (IEnumerable)source.GetCurrentValue(doubleArray) == null ? null : (double[])((ValueComparer>)doubleArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(doubleArray))); + var entity0 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], List, List, CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], List, List, CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], List, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32, CompiledModelTestBase.EnumU16, CompiledModelTestBase.EnumU16[]>(((ValueComparer)doubleNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToBytesConverterProperty)), ((ValueComparer)doubleNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToStringConverterProperty)), ((ValueComparer)enum16.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16)), (IEnumerable)source.GetCurrentValue(enum16Array) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16Array)), ((ValueComparer)enum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16AsString)), (IEnumerable)source.GetCurrentValue(enum16AsStringArray) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum16AsStringCollection) == null ? null : (List)((ValueComparer>)enum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum16Collection) == null ? null : (List)((ValueComparer>)enum16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16Collection)), ((ValueComparer)enum32.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32)), (IEnumerable)source.GetCurrentValue(enum32Array) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32Array)), ((ValueComparer)enum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32AsString)), (IEnumerable)source.GetCurrentValue(enum32AsStringArray) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum32AsStringCollection) == null ? null : (List)((ValueComparer>)enum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum32Collection) == null ? null : (List)((ValueComparer>)enum32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32Collection)), ((ValueComparer)enum64.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64)), (IEnumerable)source.GetCurrentValue(enum64Array) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64Array)), ((ValueComparer)enum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64AsString)), (IEnumerable)source.GetCurrentValue(enum64AsStringArray) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum64AsStringCollection) == null ? null : (List)((ValueComparer>)enum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum64Collection) == null ? null : (List)((ValueComparer>)enum64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64Collection)), ((ValueComparer)enum8.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8)), (IEnumerable)source.GetCurrentValue(enum8Array) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8Array)), ((ValueComparer)enum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8AsString)), (IEnumerable)source.GetCurrentValue(enum8AsStringArray) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum8AsStringCollection) == null ? null : (List)((ValueComparer>)enum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum8Collection) == null ? null : (List)((ValueComparer>)enum8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8Collection)), ((ValueComparer)enumToNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToNumberConverterProperty)), ((ValueComparer)enumToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToStringConverterProperty)), ((ValueComparer)enumU16.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16)), (IEnumerable)source.GetCurrentValue(enumU16Array) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16Array))); + var entity1 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg1 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], List, List, CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], List, List, CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], List, List, float, float[], Guid, Guid[], Guid, Guid, IPAddress, IPAddress[]>(((ValueComparer)enumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16AsString)), (IEnumerable)source.GetCurrentValue(enumU16AsStringArray) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection) == null ? null : (List)((ValueComparer>)enumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU16Collection) == null ? null : (List)((ValueComparer>)enumU16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16Collection)), ((ValueComparer)enumU32.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32)), (IEnumerable)source.GetCurrentValue(enumU32Array) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32Array)), ((ValueComparer)enumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32AsString)), (IEnumerable)source.GetCurrentValue(enumU32AsStringArray) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection) == null ? null : (List)((ValueComparer>)enumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU32Collection) == null ? null : (List)((ValueComparer>)enumU32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32Collection)), ((ValueComparer)enumU64.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64)), (IEnumerable)source.GetCurrentValue(enumU64Array) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64Array)), ((ValueComparer)enumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64AsString)), (IEnumerable)source.GetCurrentValue(enumU64AsStringArray) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection) == null ? null : (List)((ValueComparer>)enumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU64Collection) == null ? null : (List)((ValueComparer>)enumU64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64Collection)), ((ValueComparer)enumU8.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8)), (IEnumerable)source.GetCurrentValue(enumU8Array) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8Array)), ((ValueComparer)enumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8AsString)), (IEnumerable)source.GetCurrentValue(enumU8AsStringArray) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection) == null ? null : (List)((ValueComparer>)enumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU8Collection) == null ? null : (List)((ValueComparer>)enumU8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8Collection)), ((ValueComparer)@float.GetValueComparer()).Snapshot(source.GetCurrentValue(@float)), (IEnumerable)source.GetCurrentValue(floatArray) == null ? null : (float[])((ValueComparer>)floatArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(floatArray)), ((ValueComparer)guid.GetValueComparer()).Snapshot(source.GetCurrentValue(guid)), (IEnumerable)source.GetCurrentValue(guidArray) == null ? null : (Guid[])((ValueComparer>)guidArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(guidArray)), ((ValueComparer)guidToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToBytesConverterProperty)), ((ValueComparer)guidToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToStringConverterProperty)), source.GetCurrentValue(iPAddress) == null ? null : ((ValueComparer)iPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddress)), (IEnumerable)source.GetCurrentValue(iPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)iPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(iPAddressArray))); + var entity2 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg2 = (ISnapshot)new Snapshot, Nullable, Nullable[], byte[], byte[][], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable>(source.GetCurrentValue(iPAddressToBytesConverterProperty) == null ? null : ((ValueComparer)iPAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToBytesConverterProperty)), source.GetCurrentValue(iPAddressToStringConverterProperty) == null ? null : ((ValueComparer)iPAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToStringConverterProperty)), ((ValueComparer)int16.GetValueComparer()).Snapshot(source.GetCurrentValue(int16)), (IEnumerable)source.GetCurrentValue(int16Array) == null ? null : (short[])((ValueComparer>)int16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int16Array)), ((ValueComparer)int32.GetValueComparer()).Snapshot(source.GetCurrentValue(int32)), (IEnumerable)source.GetCurrentValue(int32Array) == null ? null : (int[])((ValueComparer>)int32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int32Array)), ((ValueComparer)int64.GetValueComparer()).Snapshot(source.GetCurrentValue(int64)), (IEnumerable)source.GetCurrentValue(int64Array) == null ? null : (long[])((ValueComparer>)int64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int64Array)), ((ValueComparer)int8.GetValueComparer()).Snapshot(source.GetCurrentValue(int8)), (IEnumerable)source.GetCurrentValue(int8Array) == null ? null : (sbyte[])((ValueComparer>)int8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int8Array)), ((ValueComparer)intNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToBytesConverterProperty)), ((ValueComparer)intNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToStringConverterProperty)), source.GetCurrentValue>(nullIntToNullStringConverterProperty) == null ? null : ((ValueComparer>)nullIntToNullStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullIntToNullStringConverterProperty)), source.GetCurrentValue>(nullableBool) == null ? null : ((ValueComparer>)nullableBool.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableBool)), (IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray) == null ? null : (Nullable[])((ValueComparer>>)nullableBoolArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray)), source.GetCurrentValue(nullableBytes) == null ? null : ((ValueComparer)nullableBytes.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableBytes)), (IEnumerable)source.GetCurrentValue(nullableBytesArray) == null ? null : (byte[][])((ValueComparer>)nullableBytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableBytesArray)), source.GetCurrentValue>(nullableChar) == null ? null : ((ValueComparer>)nullableChar.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableChar)), (IEnumerable>)source.GetCurrentValue[]>(nullableCharArray) == null ? null : (Nullable[])((ValueComparer>>)nullableCharArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableCharArray)), source.GetCurrentValue>(nullableDateOnly) == null ? null : ((ValueComparer>)nullableDateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray)), source.GetCurrentValue>(nullableDateTime) == null ? null : ((ValueComparer>)nullableDateTime.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateTime)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateTimeArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray)), source.GetCurrentValue>(nullableDecimal) == null ? null : ((ValueComparer>)nullableDecimal.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDecimal)), (IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDecimalArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray)), source.GetCurrentValue>(nullableDouble) == null ? null : ((ValueComparer>)nullableDouble.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDouble)), (IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDoubleArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray)), source.GetCurrentValue>(nullableEnum16) == null ? null : ((ValueComparer>)nullableEnum16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array)), source.GetCurrentValue>(nullableEnum16AsString) == null ? null : ((ValueComparer>)nullableEnum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16AsString))); + var entity3 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg3 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable>((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection)), source.GetCurrentValue>(nullableEnum32) == null ? null : ((ValueComparer>)nullableEnum32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array)), source.GetCurrentValue>(nullableEnum32AsString) == null ? null : ((ValueComparer>)nullableEnum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection)), source.GetCurrentValue>(nullableEnum64) == null ? null : ((ValueComparer>)nullableEnum64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array)), source.GetCurrentValue>(nullableEnum64AsString) == null ? null : ((ValueComparer>)nullableEnum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection)), source.GetCurrentValue>(nullableEnum8) == null ? null : ((ValueComparer>)nullableEnum8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array)), source.GetCurrentValue>(nullableEnum8AsString) == null ? null : ((ValueComparer>)nullableEnum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection)), source.GetCurrentValue>(nullableEnumU16) == null ? null : ((ValueComparer>)nullableEnumU16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array)), source.GetCurrentValue>(nullableEnumU16AsString) == null ? null : ((ValueComparer>)nullableEnumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection)), source.GetCurrentValue>(nullableEnumU32) == null ? null : ((ValueComparer>)nullableEnumU32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array)), source.GetCurrentValue>(nullableEnumU32AsString) == null ? null : ((ValueComparer>)nullableEnumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32AsString))); + var entity4 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg4 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], IPAddress, IPAddress[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], PhysicalAddress>((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection)), source.GetCurrentValue>(nullableEnumU64) == null ? null : ((ValueComparer>)nullableEnumU64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array)), source.GetCurrentValue>(nullableEnumU64AsString) == null ? null : ((ValueComparer>)nullableEnumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection)), source.GetCurrentValue>(nullableEnumU8) == null ? null : ((ValueComparer>)nullableEnumU8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array)), source.GetCurrentValue>(nullableEnumU8AsString) == null ? null : ((ValueComparer>)nullableEnumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection)), source.GetCurrentValue>(nullableFloat) == null ? null : ((ValueComparer>)nullableFloat.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableFloat)), (IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray) == null ? null : (Nullable[])((ValueComparer>>)nullableFloatArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray)), source.GetCurrentValue>(nullableGuid) == null ? null : ((ValueComparer>)nullableGuid.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableGuid)), (IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray) == null ? null : (Nullable[])((ValueComparer>>)nullableGuidArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray)), source.GetCurrentValue(nullableIPAddress) == null ? null : ((ValueComparer)nullableIPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableIPAddress)), (IEnumerable)source.GetCurrentValue(nullableIPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)nullableIPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableIPAddressArray)), source.GetCurrentValue>(nullableInt16) == null ? null : ((ValueComparer>)nullableInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array)), source.GetCurrentValue>(nullableInt32) == null ? null : ((ValueComparer>)nullableInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array)), source.GetCurrentValue>(nullableInt64) == null ? null : ((ValueComparer>)nullableInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array)), source.GetCurrentValue>(nullableInt8) == null ? null : ((ValueComparer>)nullableInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array)), source.GetCurrentValue(nullablePhysicalAddress) == null ? null : ((ValueComparer)nullablePhysicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullablePhysicalAddress))); + var entity5 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg5 = (ISnapshot)new Snapshot, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Uri, Uri[], PhysicalAddress, PhysicalAddress[], PhysicalAddress, PhysicalAddress, string, string[], string, string, string, string, string, string, string>((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)nullablePhysicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray)), source.GetCurrentValue(nullableString) == null ? null : ((ValueComparer)nullableString.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableString)), (IEnumerable)source.GetCurrentValue(nullableStringArray) == null ? null : (string[])((ValueComparer>)nullableStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableStringArray)), source.GetCurrentValue>(nullableTimeOnly) == null ? null : ((ValueComparer>)nullableTimeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray)), source.GetCurrentValue>(nullableTimeSpan) == null ? null : ((ValueComparer>)nullableTimeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeSpan)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeSpanArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray)), source.GetCurrentValue>(nullableUInt16) == null ? null : ((ValueComparer>)nullableUInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array)), source.GetCurrentValue>(nullableUInt32) == null ? null : ((ValueComparer>)nullableUInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array)), source.GetCurrentValue>(nullableUInt64) == null ? null : ((ValueComparer>)nullableUInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array)), source.GetCurrentValue>(nullableUInt8) == null ? null : ((ValueComparer>)nullableUInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array)), source.GetCurrentValue(nullableUri) == null ? null : ((ValueComparer)nullableUri.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableUri)), (IEnumerable)source.GetCurrentValue(nullableUriArray) == null ? null : (Uri[])((ValueComparer>)nullableUriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableUriArray)), source.GetCurrentValue(physicalAddress) == null ? null : ((ValueComparer)physicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddress)), (IEnumerable)source.GetCurrentValue(physicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)physicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(physicalAddressArray)), source.GetCurrentValue(physicalAddressToBytesConverterProperty) == null ? null : ((ValueComparer)physicalAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToBytesConverterProperty)), source.GetCurrentValue(physicalAddressToStringConverterProperty) == null ? null : ((ValueComparer)physicalAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToStringConverterProperty)), source.GetCurrentValue(@string) == null ? null : ((ValueComparer)@string.GetValueComparer()).Snapshot(source.GetCurrentValue(@string)), (IEnumerable)source.GetCurrentValue(stringArray) == null ? null : (string[])((ValueComparer>)stringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(stringArray)), source.GetCurrentValue(stringToBoolConverterProperty) == null ? null : ((ValueComparer)stringToBoolConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBoolConverterProperty)), source.GetCurrentValue(stringToBytesConverterProperty) == null ? null : ((ValueComparer)stringToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBytesConverterProperty)), source.GetCurrentValue(stringToCharConverterProperty) == null ? null : ((ValueComparer)stringToCharConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToCharConverterProperty)), source.GetCurrentValue(stringToDateOnlyConverterProperty) == null ? null : ((ValueComparer)stringToDateOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateOnlyConverterProperty)), source.GetCurrentValue(stringToDateTimeConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeConverterProperty)), source.GetCurrentValue(stringToDateTimeOffsetConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeOffsetConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeOffsetConverterProperty)), source.GetCurrentValue(stringToDecimalNumberConverterProperty) == null ? null : ((ValueComparer)stringToDecimalNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDecimalNumberConverterProperty))); + var entity6 = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, liftedArg0, liftedArg1, liftedArg2, liftedArg3, liftedArg4, liftedArg5, (ISnapshot)new Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty) == null ? null : ((ValueComparer)stringToDoubleNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty)), source.GetCurrentValue(stringToEnumConverterProperty) == null ? null : ((ValueComparer)stringToEnumConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToEnumConverterProperty)), source.GetCurrentValue(stringToGuidConverterProperty) == null ? null : ((ValueComparer)stringToGuidConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToGuidConverterProperty)), source.GetCurrentValue(stringToIntNumberConverterProperty) == null ? null : ((ValueComparer)stringToIntNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToIntNumberConverterProperty)), source.GetCurrentValue(stringToTimeOnlyConverterProperty) == null ? null : ((ValueComparer)stringToTimeOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeOnlyConverterProperty)), source.GetCurrentValue(stringToTimeSpanConverterProperty) == null ? null : ((ValueComparer)stringToTimeSpanConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeSpanConverterProperty)), source.GetCurrentValue(stringToUriConverterProperty) == null ? null : ((ValueComparer)stringToUriConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToUriConverterProperty)), ((ValueComparer)timeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnly)), (IEnumerable)source.GetCurrentValue(timeOnlyArray) == null ? null : (TimeOnly[])((ValueComparer>)timeOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeOnlyArray)), ((ValueComparer)timeOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToStringConverterProperty)), ((ValueComparer)timeOnlyToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToTicksConverterProperty)), ((ValueComparer)timeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpan)), (IEnumerable)source.GetCurrentValue(timeSpanArray) == null ? null : (TimeSpan[])((ValueComparer>)timeSpanArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeSpanArray)), ((ValueComparer)timeSpanToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToStringConverterProperty)), ((ValueComparer)timeSpanToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToTicksConverterProperty)), ((ValueComparer)uInt16.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt16)), (IEnumerable)source.GetCurrentValue(uInt16Array) == null ? null : (ushort[])((ValueComparer>)uInt16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt16Array)), ((ValueComparer)uInt32.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt32)), (IEnumerable)source.GetCurrentValue(uInt32Array) == null ? null : (uint[])((ValueComparer>)uInt32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt32Array)), ((ValueComparer)uInt64.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt64)), (IEnumerable)source.GetCurrentValue(uInt64Array) == null ? null : (ulong[])((ValueComparer>)uInt64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt64Array)), ((ValueComparer)uInt8.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8)), source.GetCurrentValue(uInt8Array) == null ? null : ((ValueComparer)uInt8Array.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8Array)), source.GetCurrentValue(uri) == null ? null : ((ValueComparer)uri.GetValueComparer()).Snapshot(source.GetCurrentValue(uri)), (IEnumerable)source.GetCurrentValue(uriArray) == null ? null : (Uri[])((ValueComparer>)uriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uriArray)), source.GetCurrentValue(uriToStringConverterProperty) == null ? null : ((ValueComparer)uriToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(uriToStringConverterProperty))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(CompiledModelTestBase.ManyTypesId)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(CompiledModelTestBase.ManyTypesId))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 236, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 236, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -9798,5 +15036,2129 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.ManyTypesId GetId(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.ManyTypesId ReadId(CompiledModelTestBase.ManyTypes @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.ManyTypesId value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBool(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBool(CompiledModelTestBase.ManyTypes @this) + => GetBool(@this); + + public static void WriteBool(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool[] GetBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool[] ReadBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetBoolArray(@this); + + public static void WriteBoolArray(CompiledModelTestBase.ManyTypes @this, bool[] value) + => GetBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToStringConverterProperty(@this); + + public static void WriteBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToTwoValuesConverterProperty(@this); + + public static void WriteBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToTwoValuesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToZeroOneConverterProperty(@this); + + public static void WriteBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToZeroOneConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytes(CompiledModelTestBase.ManyTypes @this) + => GetBytes(@this); + + public static void WriteBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetBytesArray(@this); + + public static void WriteBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBytesToStringConverterProperty(@this); + + public static void WriteBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytesToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetCastingConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadCastingConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCastingConverterProperty(@this); + + public static void WriteCastingConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetCastingConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetChar(CompiledModelTestBase.ManyTypes @this); + + public static char ReadChar(CompiledModelTestBase.ManyTypes @this) + => GetChar(@this); + + public static void WriteChar(CompiledModelTestBase.ManyTypes @this, char value) + => GetChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char[] GetCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char[] ReadCharArray(CompiledModelTestBase.ManyTypes @this) + => GetCharArray(@this); + + public static void WriteCharArray(CompiledModelTestBase.ManyTypes @this, char[] value) + => GetCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static char ReadCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCharToStringConverterProperty(@this); + + public static void WriteCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, char value) + => GetCharToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetDateOnly(@this); + + public static void WriteDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly[] GetDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly[] ReadDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyArray(@this); + + public static void WriteDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly[] value) + => GetDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyToStringConverterProperty(@this); + + public static void WriteDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTime(CompiledModelTestBase.ManyTypes @this) + => GetDateTime(@this); + + public static void WriteDateTime(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime[] ReadDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeArray(@this); + + public static void WriteDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime[] value) + => GetDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBinaryConverterProperty(@this); + + public static void WriteDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBytesConverterProperty(@this); + + public static void WriteDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToStringConverterProperty(@this); + + public static void WriteDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToBinaryConverterProperty(@this); + + public static void WriteDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToStringConverterProperty(@this); + + public static void WriteDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToTicksConverterProperty(@this); + + public static void WriteDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimal(CompiledModelTestBase.ManyTypes @this) + => GetDecimal(@this); + + public static void WriteDecimal(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal[] GetDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal[] ReadDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetDecimalArray(@this); + + public static void WriteDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal[] value) + => GetDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToBytesConverterProperty(@this); + + public static void WriteDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToStringConverterProperty(@this); + + public static void WriteDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDouble(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDouble(CompiledModelTestBase.ManyTypes @this) + => GetDouble(@this); + + public static void WriteDouble(CompiledModelTestBase.ManyTypes @this, double value) + => GetDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double[] GetDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double[] ReadDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetDoubleArray(@this); + + public static void WriteDoubleArray(CompiledModelTestBase.ManyTypes @this, double[] value) + => GetDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToBytesConverterProperty(@this); + + public static void WriteDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToStringConverterProperty(@this); + + public static void WriteDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16(CompiledModelTestBase.ManyTypes @this) + => GetEnum16(@this); + + public static void WriteEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Array(@this); + + public static void WriteEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsString(@this); + + public static void WriteEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringArray(@this); + + public static void WriteEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringCollection(@this); + + public static void WriteEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Collection(@this); + + public static void WriteEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32(CompiledModelTestBase.ManyTypes @this) + => GetEnum32(@this); + + public static void WriteEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Array(@this); + + public static void WriteEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsString(@this); + + public static void WriteEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringArray(@this); + + public static void WriteEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringCollection(@this); + + public static void WriteEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Collection(@this); + + public static void WriteEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64(CompiledModelTestBase.ManyTypes @this) + => GetEnum64(@this); + + public static void WriteEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Array(@this); + + public static void WriteEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsString(@this); + + public static void WriteEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringArray(@this); + + public static void WriteEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringCollection(@this); + + public static void WriteEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Collection(@this); + + public static void WriteEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8(CompiledModelTestBase.ManyTypes @this) + => GetEnum8(@this); + + public static void WriteEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Array(@this); + + public static void WriteEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsString(@this); + + public static void WriteEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringArray(@this); + + public static void WriteEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringCollection(@this); + + public static void WriteEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Collection(@this); + + public static void WriteEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToNumberConverterProperty(@this); + + public static void WriteEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToStringConverterProperty(@this); + + public static void WriteEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16(@this); + + public static void WriteEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Array(@this); + + public static void WriteEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsString(@this); + + public static void WriteEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringArray(@this); + + public static void WriteEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringCollection(@this); + + public static void WriteEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Collection(@this); + + public static void WriteEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32(@this); + + public static void WriteEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Array(@this); + + public static void WriteEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsString(@this); + + public static void WriteEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringArray(@this); + + public static void WriteEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringCollection(@this); + + public static void WriteEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Collection(@this); + + public static void WriteEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64(@this); + + public static void WriteEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Array(@this); + + public static void WriteEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsString(@this); + + public static void WriteEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringArray(@this); + + public static void WriteEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringCollection(@this); + + public static void WriteEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Collection(@this); + + public static void WriteEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8(@this); + + public static void WriteEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Array(@this); + + public static void WriteEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsString(@this); + + public static void WriteEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringArray(@this); + + public static void WriteEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringCollection(@this); + + public static void WriteEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Collection(@this); + + public static void WriteEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float GetFloat(CompiledModelTestBase.ManyTypes @this); + + public static float ReadFloat(CompiledModelTestBase.ManyTypes @this) + => GetFloat(@this); + + public static void WriteFloat(CompiledModelTestBase.ManyTypes @this, float value) + => GetFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float[] GetFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float[] ReadFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetFloatArray(@this); + + public static void WriteFloatArray(CompiledModelTestBase.ManyTypes @this, float[] value) + => GetFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuid(CompiledModelTestBase.ManyTypes @this) + => GetGuid(@this); + + public static void WriteGuid(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid[] GetGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid[] ReadGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetGuidArray(@this); + + public static void WriteGuidArray(CompiledModelTestBase.ManyTypes @this, Guid[] value) + => GetGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToBytesConverterProperty(@this); + + public static void WriteGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToStringConverterProperty(@this); + + public static void WriteGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetIPAddress(@this); + + public static void WriteIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressArray(@this); + + public static void WriteIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToBytesConverterProperty(@this); + + public static void WriteIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToStringConverterProperty(@this); + + public static void WriteIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short GetInt16(CompiledModelTestBase.ManyTypes @this); + + public static short ReadInt16(CompiledModelTestBase.ManyTypes @this) + => GetInt16(@this); + + public static void WriteInt16(CompiledModelTestBase.ManyTypes @this, short value) + => GetInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short[] GetInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short[] ReadInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetInt16Array(@this); + + public static void WriteInt16Array(CompiledModelTestBase.ManyTypes @this, short[] value) + => GetInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetInt32(CompiledModelTestBase.ManyTypes @this); + + public static int ReadInt32(CompiledModelTestBase.ManyTypes @this) + => GetInt32(@this); + + public static void WriteInt32(CompiledModelTestBase.ManyTypes @this, int value) + => GetInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int[] GetInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int[] ReadInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetInt32Array(@this); + + public static void WriteInt32Array(CompiledModelTestBase.ManyTypes @this, int[] value) + => GetInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetInt64(CompiledModelTestBase.ManyTypes @this); + + public static long ReadInt64(CompiledModelTestBase.ManyTypes @this) + => GetInt64(@this); + + public static void WriteInt64(CompiledModelTestBase.ManyTypes @this, long value) + => GetInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long[] GetInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long[] ReadInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetInt64Array(@this); + + public static void WriteInt64Array(CompiledModelTestBase.ManyTypes @this, long[] value) + => GetInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte GetInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte ReadInt8(CompiledModelTestBase.ManyTypes @this) + => GetInt8(@this); + + public static void WriteInt8(CompiledModelTestBase.ManyTypes @this, sbyte value) + => GetInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte[] GetInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte[] ReadInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetInt8Array(@this); + + public static void WriteInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte[] value) + => GetInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToBytesConverterProperty(@this); + + public static void WriteIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToStringConverterProperty(@this); + + public static void WriteIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetNullIntToNullStringConverterProperty(@this); + + public static void WriteNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullIntToNullStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool? GetNullableBool(CompiledModelTestBase.ManyTypes @this); + + public static bool? ReadNullableBool(CompiledModelTestBase.ManyTypes @this) + => GetNullableBool(@this); + + public static void WriteNullableBool(CompiledModelTestBase.ManyTypes @this, bool? value) + => GetNullableBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool?[] GetNullableBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool?[] ReadNullableBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBoolArray(@this); + + public static void WriteNullableBoolArray(CompiledModelTestBase.ManyTypes @this, bool?[] value) + => GetNullableBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetNullableBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadNullableBytes(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytes(@this); + + public static void WriteNullableBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetNullableBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetNullableBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadNullableBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytesArray(@this); + + public static void WriteNullableBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetNullableBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char? GetNullableChar(CompiledModelTestBase.ManyTypes @this); + + public static char? ReadNullableChar(CompiledModelTestBase.ManyTypes @this) + => GetNullableChar(@this); + + public static void WriteNullableChar(CompiledModelTestBase.ManyTypes @this, char? value) + => GetNullableChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char?[] GetNullableCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char?[] ReadNullableCharArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableCharArray(@this); + + public static void WriteNullableCharArray(CompiledModelTestBase.ManyTypes @this, char?[] value) + => GetNullableCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly? GetNullableDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly? ReadNullableDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnly(@this); + + public static void WriteNullableDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly? value) + => GetNullableDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly?[] GetNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly?[] ReadNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnlyArray(@this); + + public static void WriteNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly?[] value) + => GetNullableDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime? GetNullableDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime? ReadNullableDateTime(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTime(@this); + + public static void WriteNullableDateTime(CompiledModelTestBase.ManyTypes @this, DateTime? value) + => GetNullableDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime?[] GetNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime?[] ReadNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTimeArray(@this); + + public static void WriteNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime?[] value) + => GetNullableDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal? GetNullableDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal? ReadNullableDecimal(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimal(@this); + + public static void WriteNullableDecimal(CompiledModelTestBase.ManyTypes @this, decimal? value) + => GetNullableDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal?[] GetNullableDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal?[] ReadNullableDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimalArray(@this); + + public static void WriteNullableDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal?[] value) + => GetNullableDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double? GetNullableDouble(CompiledModelTestBase.ManyTypes @this); + + public static double? ReadNullableDouble(CompiledModelTestBase.ManyTypes @this) + => GetNullableDouble(@this); + + public static void WriteNullableDouble(CompiledModelTestBase.ManyTypes @this, double? value) + => GetNullableDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double?[] GetNullableDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double?[] ReadNullableDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDoubleArray(@this); + + public static void WriteNullableDoubleArray(CompiledModelTestBase.ManyTypes @this, double?[] value) + => GetNullableDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16(@this); + + public static void WriteNullableEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Array(@this); + + public static void WriteNullableEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsString(@this); + + public static void WriteNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringArray(@this); + + public static void WriteNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringCollection(@this); + + public static void WriteNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Collection(@this); + + public static void WriteNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32(@this); + + public static void WriteNullableEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Array(@this); + + public static void WriteNullableEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsString(@this); + + public static void WriteNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringArray(@this); + + public static void WriteNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringCollection(@this); + + public static void WriteNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Collection(@this); + + public static void WriteNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64(@this); + + public static void WriteNullableEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Array(@this); + + public static void WriteNullableEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsString(@this); + + public static void WriteNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringArray(@this); + + public static void WriteNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringCollection(@this); + + public static void WriteNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Collection(@this); + + public static void WriteNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8(@this); + + public static void WriteNullableEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Array(@this); + + public static void WriteNullableEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsString(@this); + + public static void WriteNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringArray(@this); + + public static void WriteNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringCollection(@this); + + public static void WriteNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Collection(@this); + + public static void WriteNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16(@this); + + public static void WriteNullableEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Array(@this); + + public static void WriteNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsString(@this); + + public static void WriteNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringArray(@this); + + public static void WriteNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringCollection(@this); + + public static void WriteNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Collection(@this); + + public static void WriteNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32(@this); + + public static void WriteNullableEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Array(@this); + + public static void WriteNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsString(@this); + + public static void WriteNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringArray(@this); + + public static void WriteNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringCollection(@this); + + public static void WriteNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Collection(@this); + + public static void WriteNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64(@this); + + public static void WriteNullableEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Array(@this); + + public static void WriteNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsString(@this); + + public static void WriteNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringArray(@this); + + public static void WriteNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringCollection(@this); + + public static void WriteNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Collection(@this); + + public static void WriteNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8(@this); + + public static void WriteNullableEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Array(@this); + + public static void WriteNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsString(@this); + + public static void WriteNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringArray(@this); + + public static void WriteNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringCollection(@this); + + public static void WriteNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Collection(@this); + + public static void WriteNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float? GetNullableFloat(CompiledModelTestBase.ManyTypes @this); + + public static float? ReadNullableFloat(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloat(@this); + + public static void WriteNullableFloat(CompiledModelTestBase.ManyTypes @this, float? value) + => GetNullableFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float?[] GetNullableFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float?[] ReadNullableFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloatArray(@this); + + public static void WriteNullableFloatArray(CompiledModelTestBase.ManyTypes @this, float?[] value) + => GetNullableFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid? GetNullableGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid? ReadNullableGuid(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuid(@this); + + public static void WriteNullableGuid(CompiledModelTestBase.ManyTypes @this, Guid? value) + => GetNullableGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid?[] GetNullableGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid?[] ReadNullableGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuidArray(@this); + + public static void WriteNullableGuidArray(CompiledModelTestBase.ManyTypes @this, Guid?[] value) + => GetNullableGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetNullableIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadNullableIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddress(@this); + + public static void WriteNullableIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetNullableIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddressArray(@this); + + public static void WriteNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetNullableIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short? GetNullableInt16(CompiledModelTestBase.ManyTypes @this); + + public static short? ReadNullableInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16(@this); + + public static void WriteNullableInt16(CompiledModelTestBase.ManyTypes @this, short? value) + => GetNullableInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short?[] GetNullableInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short?[] ReadNullableInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16Array(@this); + + public static void WriteNullableInt16Array(CompiledModelTestBase.ManyTypes @this, short?[] value) + => GetNullableInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullableInt32(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullableInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32(@this); + + public static void WriteNullableInt32(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullableInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int?[] GetNullableInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int?[] ReadNullableInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32Array(@this); + + public static void WriteNullableInt32Array(CompiledModelTestBase.ManyTypes @this, int?[] value) + => GetNullableInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetNullableInt64(CompiledModelTestBase.ManyTypes @this); + + public static long? ReadNullableInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64(@this); + + public static void WriteNullableInt64(CompiledModelTestBase.ManyTypes @this, long? value) + => GetNullableInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long?[] GetNullableInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long?[] ReadNullableInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64Array(@this); + + public static void WriteNullableInt64Array(CompiledModelTestBase.ManyTypes @this, long?[] value) + => GetNullableInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte? GetNullableInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte? ReadNullableInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8(@this); + + public static void WriteNullableInt8(CompiledModelTestBase.ManyTypes @this, sbyte? value) + => GetNullableInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte?[] GetNullableInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte?[] ReadNullableInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8Array(@this); + + public static void WriteNullableInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte?[] value) + => GetNullableInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddress(@this); + + public static void WriteNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetNullablePhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddressArray(@this); + + public static void WriteNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetNullablePhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNullableString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadNullableString(CompiledModelTestBase.ManyTypes @this) + => GetNullableString(@this); + + public static void WriteNullableString(CompiledModelTestBase.ManyTypes @this, string value) + => GetNullableString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetNullableStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadNullableStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableStringArray(@this); + + public static void WriteNullableStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetNullableStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly? GetNullableTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly? ReadNullableTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnly(@this); + + public static void WriteNullableTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly? value) + => GetNullableTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly?[] GetNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly?[] ReadNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnlyArray(@this); + + public static void WriteNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly?[] value) + => GetNullableTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan? GetNullableTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan? ReadNullableTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpan(@this); + + public static void WriteNullableTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan? value) + => GetNullableTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan?[] GetNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan?[] ReadNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpanArray(@this); + + public static void WriteNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan?[] value) + => GetNullableTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort? GetNullableUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort? ReadNullableUInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16(@this); + + public static void WriteNullableUInt16(CompiledModelTestBase.ManyTypes @this, ushort? value) + => GetNullableUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort?[] GetNullableUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort?[] ReadNullableUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16Array(@this); + + public static void WriteNullableUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort?[] value) + => GetNullableUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint? GetNullableUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint? ReadNullableUInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32(@this); + + public static void WriteNullableUInt32(CompiledModelTestBase.ManyTypes @this, uint? value) + => GetNullableUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint?[] GetNullableUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint?[] ReadNullableUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32Array(@this); + + public static void WriteNullableUInt32Array(CompiledModelTestBase.ManyTypes @this, uint?[] value) + => GetNullableUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong? GetNullableUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong? ReadNullableUInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64(@this); + + public static void WriteNullableUInt64(CompiledModelTestBase.ManyTypes @this, ulong? value) + => GetNullableUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong?[] GetNullableUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong?[] ReadNullableUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64Array(@this); + + public static void WriteNullableUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong?[] value) + => GetNullableUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetNullableUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte? ReadNullableUInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8(@this); + + public static void WriteNullableUInt8(CompiledModelTestBase.ManyTypes @this, byte? value) + => GetNullableUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte?[] GetNullableUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte?[] ReadNullableUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8Array(@this); + + public static void WriteNullableUInt8Array(CompiledModelTestBase.ManyTypes @this, byte?[] value) + => GetNullableUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetNullableUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadNullableUri(CompiledModelTestBase.ManyTypes @this) + => GetNullableUri(@this); + + public static void WriteNullableUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetNullableUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetNullableUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadNullableUriArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableUriArray(@this); + + public static void WriteNullableUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetNullableUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddress(@this); + + public static void WritePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressArray(@this); + + public static void WritePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetPhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToBytesConverterProperty(@this); + + public static void WritePhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToStringConverterProperty(@this); + + public static void WritePhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadString(CompiledModelTestBase.ManyTypes @this) + => GetString(@this); + + public static void WriteString(CompiledModelTestBase.ManyTypes @this, string value) + => GetString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadStringArray(CompiledModelTestBase.ManyTypes @this) + => GetStringArray(@this); + + public static void WriteStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBoolConverterProperty(@this); + + public static void WriteStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBoolConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBytesConverterProperty(@this); + + public static void WriteStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToCharConverterProperty(@this); + + public static void WriteStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToCharConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateOnlyConverterProperty(@this); + + public static void WriteStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeConverterProperty(@this); + + public static void WriteStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeOffsetConverterProperty(@this); + + public static void WriteStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeOffsetConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDecimalNumberConverterProperty(@this); + + public static void WriteStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDecimalNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDoubleNumberConverterProperty(@this); + + public static void WriteStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDoubleNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToEnumConverterProperty(@this); + + public static void WriteStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToEnumConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToGuidConverterProperty(@this); + + public static void WriteStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToGuidConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToIntNumberConverterProperty(@this); + + public static void WriteStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToIntNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeOnlyConverterProperty(@this); + + public static void WriteStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeSpanConverterProperty(@this); + + public static void WriteStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeSpanConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToUriConverterProperty(@this); + + public static void WriteStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToUriConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnly(@this); + + public static void WriteTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly[] GetTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly[] ReadTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyArray(@this); + + public static void WriteTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly[] value) + => GetTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToStringConverterProperty(@this); + + public static void WriteTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToTicksConverterProperty(@this); + + public static void WriteTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpan(@this); + + public static void WriteTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan[] GetTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan[] ReadTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanArray(@this); + + public static void WriteTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan[] value) + => GetTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToStringConverterProperty(@this); + + public static void WriteTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToTicksConverterProperty(@this); + + public static void WriteTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort GetUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort ReadUInt16(CompiledModelTestBase.ManyTypes @this) + => GetUInt16(@this); + + public static void WriteUInt16(CompiledModelTestBase.ManyTypes @this, ushort value) + => GetUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort[] GetUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort[] ReadUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt16Array(@this); + + public static void WriteUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort[] value) + => GetUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint GetUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint ReadUInt32(CompiledModelTestBase.ManyTypes @this) + => GetUInt32(@this); + + public static void WriteUInt32(CompiledModelTestBase.ManyTypes @this, uint value) + => GetUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint[] GetUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint[] ReadUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt32Array(@this); + + public static void WriteUInt32Array(CompiledModelTestBase.ManyTypes @this, uint[] value) + => GetUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong GetUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong ReadUInt64(CompiledModelTestBase.ManyTypes @this) + => GetUInt64(@this); + + public static void WriteUInt64(CompiledModelTestBase.ManyTypes @this, ulong value) + => GetUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong[] GetUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong[] ReadUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt64Array(@this); + + public static void WriteUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong[] value) + => GetUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte GetUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte ReadUInt8(CompiledModelTestBase.ManyTypes @this) + => GetUInt8(@this); + + public static void WriteUInt8(CompiledModelTestBase.ManyTypes @this, byte value) + => GetUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt8Array(@this); + + public static void WriteUInt8Array(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUri(CompiledModelTestBase.ManyTypes @this) + => GetUri(@this); + + public static void WriteUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadUriArray(CompiledModelTestBase.ManyTypes @this) + => GetUriArray(@this); + + public static void WriteUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetUriToStringConverterProperty(@this); + + public static void WriteUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUriToStringConverterProperty(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs index edf50c13228..ee817ffb63f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +39,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalDerivedId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalDerivedId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -49,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); principalDerivedId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalDerivedAlternateId = runtimeEntityType.AddProperty( @@ -56,6 +66,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalDerivedAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalDerivedAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -71,6 +87,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalDerivedAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedAlternateId)); principalDerivedAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var id = runtimeEntityType.AddProperty( @@ -79,6 +96,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: 2, + storeGenerationIndex: 2); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -92,6 +115,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var details = runtimeEntityType.AddProperty( @@ -100,6 +124,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[3]); + details.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -126,6 +171,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[4]); + number.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -147,6 +213,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeArray.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -211,6 +298,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeEnumerable.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -259,6 +367,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeIList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -307,6 +436,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeList.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -371,6 +521,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeArray.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -414,6 +585,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeEnumerable.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -457,6 +649,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeIList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -500,6 +713,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeList.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -565,22 +799,179 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("ManyOwned", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), eagerLoaded: true); + manyOwned.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance) == null); + manyOwned.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(manyOwned), + null); + manyOwned.SetPropertyIndexes( + index: 3, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + manyOwned.SetCollectionAccessor>, ICollection, CompiledModelTestBase.OwnedType>( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.OwnedType>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var principalDerivedAlternateId = runtimeEntityType.FindProperty("PrincipalDerivedAlternateId")!; + var id = runtimeEntityType.FindProperty("Id")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalDerivedId") ? (long)source["PrincipalDerivedId"] : 0L, source.ContainsKey("PrincipalDerivedAlternateId") ? (Guid)source["PrincipalDerivedAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 13, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 13, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); runtimeEntityType.AddAnnotation("Relational:TableName", "ManyOwned"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); - runtimeEntityType.AddAnnotation("SqlServer:MemoryOptimized", true); Customize(runtimeEntityType); } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs index c6a1349fe3a..cc2f46ff1ea 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -39,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalBaseId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalBaseId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -52,6 +61,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); var overrides = new StoreObjectDictionary(); var principalBaseIdPrincipalBase = new RuntimeRelationalPropertyOverrides( @@ -71,6 +81,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalBaseAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -86,6 +102,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalBaseAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseAlternateId)); principalBaseAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var details = runtimeEntityType.AddProperty( @@ -95,6 +112,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[2]); + details.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -132,6 +170,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[3]); + number.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -154,6 +213,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[4]); + refTypeArray.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -219,6 +299,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeEnumerable.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -268,6 +369,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeIList.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -317,6 +439,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -382,6 +525,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[8]); + valueTypeArray.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -426,6 +590,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeEnumerable.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -470,6 +655,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeIList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -514,6 +720,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -583,6 +810,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyAccessMode: PropertyAccessMode.Field, eagerLoaded: true); + owned.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance) == null); + owned.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(owned), + null); + owned.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); return runtimeForeignKey; } @@ -601,6 +849,46 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalBaseAlternateId = runtimeEntityType.FindProperty("PrincipalBaseAlternateId")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalBaseId") ? (long)source["PrincipalBaseId"] : 0L, source.ContainsKey("PrincipalBaseAlternateId") ? (Guid)source["PrincipalBaseAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"))); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 12, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 12, + shadowCount: 2, + relationshipCount: 2, + storeGeneratedCount: 2); var fragments = new StoreObjectDictionary(); var detailsFragment = new RuntimeEntityTypeMappingFragment( runtimeEntityType, @@ -619,5 +907,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs index 652a32b8a2d..bbb65501d3c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -40,6 +43,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -53,6 +77,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var overrides = new StoreObjectDictionary(); var idPrincipalDerived = new RuntimeRelationalPropertyOverrides( @@ -73,6 +98,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000"), jsonValueReaderWriter: JsonGuidReaderWriter.Instance); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(1) : entry.FlaggedAsTemporary(1) && ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId == new Guid("00000000-0000-0000-0000-000000000000") ? entry.ReadTemporaryValue(1) : ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(alternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + alternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); alternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -88,6 +134,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + alternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(alternateId)); alternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var enum1 = runtimeEntityType.AddProperty( @@ -95,6 +142,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum1.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -125,6 +193,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum2.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -153,6 +242,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum1.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -182,6 +292,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C)), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C))); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum2.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -212,6 +343,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeArray.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -276,6 +428,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeEnumerable.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -324,6 +497,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeIList.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -372,6 +566,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -436,6 +651,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeArray.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -479,6 +715,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeEnumerable.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -522,6 +779,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeIList.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -565,6 +843,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -638,11 +937,81 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Guid>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Guid>(default(Nullable), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ReadOwned(entity), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 14, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 14, + shadowCount: 0, + relationshipCount: 4, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPT"); runtimeEntityType.AddAnnotation("Relational:Schema", "mySchema"); @@ -655,5 +1024,140 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs index 5bc231d18c8..9d83771ded9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs @@ -6,7 +6,9 @@ using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +38,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null ? 0L : (long)(entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null ? 0L : (long)(instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null); + derivedsId.SetSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsId, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsId, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + derivedsId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); derivedsId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -49,6 +96,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + derivedsId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsId)); derivedsId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var derivedsAlternateId = runtimeEntityType.AddProperty( @@ -56,6 +104,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null); + derivedsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(1)) + { + return entry.ReadStoreGeneratedValue(1); + } + else + { + { + if (entry.FlaggedAsTemporary(1) && (((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(1); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsAlternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsAlternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + derivedsAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); derivedsAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -71,6 +164,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + derivedsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsAlternateId)); derivedsAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalsId = runtimeEntityType.AddProperty( @@ -78,6 +172,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null ? 0L : (long)(entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null ? 0L : (long)(instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null); + principalsId.SetSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(2)) + { + return entry.ReadStoreGeneratedValue(2); + } + else + { + { + if (entry.FlaggedAsTemporary(2) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null) == null) + { + return entry.ReadTemporaryValue(2); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsId, 2), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsId, 2), + (ValueBuffer valueBuffer) => valueBuffer[2]); + principalsId.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: 2); principalsId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -91,6 +230,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalsId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsId)); principalsId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalsAlternateId = runtimeEntityType.AddProperty( @@ -98,6 +238,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null); + principalsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(3)) + { + return entry.ReadStoreGeneratedValue(3); + } + else + { + { + if (entry.FlaggedAsTemporary(3) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(3); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsAlternateId, 3), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsAlternateId, 3), + (ValueBuffer valueBuffer) => valueBuffer[3]); + principalsAlternateId.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: 3); principalsAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -113,6 +298,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsAlternateId)); principalsAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var rowid = runtimeEntityType.AddProperty( @@ -124,19 +310,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + rowid.SetGetter( + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null ? null : (byte[])(entity.ContainsKey("rowid") ? entity["rowid"] : null), + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null ? null : (byte[])(instance.ContainsKey("rowid") ? instance["rowid"] : null), + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null); + rowid.SetSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetMaterializationSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(4) ? entry.ReadStoreGeneratedValue(4) : entry.FlaggedAsTemporary(4) && (((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null) == null ? entry.ReadTemporaryValue(4) : (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => entry.ReadOriginalValue(rowid, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(rowid), + (ValueBuffer valueBuffer) => valueBuffer[4]); + rowid.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 4); rowid.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(v1, v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(v1, v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "rowversion", size: 8), @@ -177,12 +384,46 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var derivedsId = runtimeEntityType.FindProperty("DerivedsId")!; + var derivedsAlternateId = runtimeEntityType.FindProperty("DerivedsAlternateId")!; + var principalsId = runtimeEntityType.FindProperty("PrincipalsId")!; + var principalsAlternateId = runtimeEntityType.FindProperty("PrincipalsAlternateId")!; + var rowid = runtimeEntityType.FindProperty("rowid")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId)), source.GetCurrentValue(rowid) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(source.GetCurrentValue(rowid))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(default(Guid)), default(byte[]) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(default(byte[])))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(long), default(Guid), default(byte[]))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 5, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 5, + shadowCount: 0, + relationshipCount: 4, + storeGeneratedCount: 5); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBasePrincipalDerived>"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + runtimeEntityType.AddAnnotation("SqlServer:MemoryOptimized", true); Customize(runtimeEntityType); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs index 4c3ed5ed544..c451995696f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs @@ -1,9 +1,14 @@ // using System; using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -53,9 +58,7 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl false, typeof(ICollection), propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: true, - lazyLoadingEnabled: false); + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var inverse = targetEntityType.FindSkipNavigation("Deriveds"); if (inverse != null) @@ -64,11 +67,83 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 4, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 6, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + var manyOwned = runtimeEntityType.FindNavigation("ManyOwned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Guid>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Guid>(default(Nullable), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object, object, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), PrincipalBaseEntityType.ReadOwned(entity), null, ReadDependent(entity), SnapshotFactoryFactory.SnapshotCollection(ReadManyOwned(entity)), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 14, + navigationCount: 5, + complexPropertyCount: 0, + originalValueCount: 14, + shadowCount: 0, + relationshipCount: 7, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -80,5 +155,32 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetPrincipals(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadPrincipals(CompiledModelTestBase.PrincipalDerived> @this) + => GetPrincipals(@this); + + public static void WritePrincipals(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetPrincipals(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "ManyOwned")] + extern static ref ICollection GetManyOwned(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadManyOwned(CompiledModelTestBase.PrincipalDerived> @this) + => GetManyOwned(@this); + + public static void WriteManyOwned(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetManyOwned(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs index 3cdcf6afeae..11c27ed7864 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs @@ -1,9 +1,13 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -38,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -51,6 +61,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); principalId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalAlternateId = runtimeEntityType.AddProperty( @@ -58,6 +69,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -73,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalAlternateId)); principalAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var enumDiscriminator = runtimeEntityType.AddProperty( @@ -80,6 +98,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum1), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + enumDiscriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: -1, + storeGenerationIndex: -1); enumDiscriminator.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum1 v1, CompiledModelTestBase.Enum1 v2) => object.Equals((object)v1, (object)v2), @@ -110,6 +134,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[3]); + id.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -164,6 +209,27 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -173,11 +239,65 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt eagerLoaded: true, lazyLoadingEnabled: false); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 4, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 4, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("DiscriminatorMappingComplete", false); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); @@ -191,5 +311,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetId(CompiledModelTestBase.DependentBase @this); + + public static byte? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, byte? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs index bc3c7e5d733..c8b2ff10716 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs @@ -1,8 +1,12 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -32,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 20, unicode: false); + data.SetGetter( + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity), + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity) == null, + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance), + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance) == null); + data.SetSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetMaterializationSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetAccessors( + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(data, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(data), + (ValueBuffer valueBuffer) => valueBuffer[4]); + data.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); data.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -59,6 +84,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas precision: 9, scale: 3, sentinel: 0m); + money.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 3, + relationshipIndex: -1, + storeGenerationIndex: -1); money.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -83,6 +114,41 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var data = runtimeEntityType.FindProperty("Data")!; + var money = runtimeEntityType.FindProperty("Money")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot, string, decimal>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(data) == null ? null : ((ValueComparer)data.GetValueComparer()).Snapshot(source.GetCurrentValue(data)), ((ValueComparer)money.GetValueComparer()).Snapshot(source.GetCurrentValue(money))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default, source.ContainsKey("Money") ? (decimal)source["Money"] : 0M)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1), default(decimal))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), DependentBaseEntityType.ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 6, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 6, + shadowCount: 4, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -94,5 +160,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetData(CompiledModelTestBase.DependentDerived @this); + + public static string ReadData(CompiledModelTestBase.DependentDerived @this) + => GetData(@this); + + public static void WriteData(CompiledModelTestBase.DependentDerived @this, string value) + => GetData(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs index 03df4d23893..ee30773de2f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs @@ -7,9 +7,12 @@ using System.Net; using System.Net.NetworkInformation; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -41,6 +44,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, valueConverter: new CompiledModelTestBase.ManyTypesIdConverter()); + id.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity).Equals(default(CompiledModelTestBase.ManyTypesId)), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance).Equals(default(CompiledModelTestBase.ManyTypesId))); + id.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelTestBase.ManyTypes)entry.Entity).Equals(default(CompiledModelTestBase.ManyTypesId)) ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.ManyTypesId v1, CompiledModelTestBase.ManyTypesId v2) => v1.Equals(v2), @@ -62,6 +86,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (CompiledModelTestBase.ManyTypesId v) => v.Id, (int v) => new CompiledModelTestBase.ManyTypesId(v)))); + id.SetCurrentValueComparer(new CurrentProviderValueComparer(id)); id.SetSentinelFromProviderValue(0); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -71,6 +96,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + @bool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance) == false); + @bool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetAccessors( + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@bool, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(@bool), + (ValueBuffer valueBuffer) => valueBuffer[1]); + @bool.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @bool.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -91,6 +137,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance) == null); + boolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetAccessors( + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolArray, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolArray), + (ValueBuffer valueBuffer) => valueBuffer[2]); + boolArray.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -133,6 +200,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance) == false); + boolToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToStringConverterProperty, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[3]); + boolToStringConverterProperty.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -167,6 +255,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToTwoValuesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToTwoValuesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance) == false); + boolToTwoValuesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToTwoValuesConverterProperty, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToTwoValuesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[4]); + boolToTwoValuesConverterProperty.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToTwoValuesConverterProperty.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -197,6 +306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToZeroOneConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BoolToZeroOneConverter()); + boolToZeroOneConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance) == false); + boolToZeroOneConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToZeroOneConverterProperty, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToZeroOneConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[5]); + boolToZeroOneConverterProperty.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToZeroOneConverterProperty.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -226,19 +356,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance) == null); + bytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetAccessors( + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytes, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytes), + (ValueBuffer valueBuffer) => valueBuffer[6]); + bytes.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytes.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -249,15 +400,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance) == null); + bytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + bytesArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -273,17 +445,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas JsonByteArrayReaderWriter.Instance), elementMapping: SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None)); @@ -296,15 +468,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BytesToStringConverter(), valueComparer: new ArrayStructuralComparer()); + bytesToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance) == null); + bytesToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesToStringConverterProperty, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[8]); + bytesToStringConverterProperty.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -314,13 +507,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas unicode: true, dbType: System.Data.DbType.String), converter: new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)), storeTypePostfix: StoreTypePostfix.None, jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonStringReaderWriter.Instance, new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)))); bytesToStringConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -330,6 +523,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CastingConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CastingConverter()); + castingConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance) == 0); + castingConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(castingConverterProperty, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(castingConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[9]); + castingConverterProperty.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); castingConverterProperty.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -359,6 +573,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Char", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @char.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance) == '\0'); + @char.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetAccessors( + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@char, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(@char), + (ValueBuffer valueBuffer) => valueBuffer[10]); + @char.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @char.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -393,6 +628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + charArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance) == null); + charArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetAccessors( + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(charArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + charArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (char v1, char v2) => v1 == v2, @@ -457,6 +713,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CharToStringConverter()); + charToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance) == '\0'); + charToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charToStringConverterProperty, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(charToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[12]); + charToStringConverterProperty.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -494,6 +771,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateOnly(1, 1, 1)); + dateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance) == default(DateOnly)); + dateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnly, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnly), + (ValueBuffer valueBuffer) => valueBuffer[13]); + dateOnly.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnly.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -514,6 +812,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance) == null); + dateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyArray, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[14]); + dateOnlyArray.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -557,6 +876,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateOnlyToStringConverter()); + dateOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance) == default(DateOnly)); + dateOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyToStringConverterProperty, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[15]); + dateOnlyToStringConverterProperty.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -592,6 +932,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance) == default(DateTime)); + dateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetAccessors( + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTime, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTime), + (ValueBuffer valueBuffer) => valueBuffer[16]); + dateTime.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTime.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -612,6 +973,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance) == null); + dateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + dateTimeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -655,6 +1037,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBinaryConverter()); + dateTimeOffsetToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBinaryConverterProperty, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[18]); + dateTimeOffsetToBinaryConverterProperty.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBinaryConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -685,6 +1088,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBytesConverter()); + dateTimeOffsetToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBytesConverterProperty, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[19]); + dateTimeOffsetToBytesConverterProperty.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -695,20 +1119,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (DateTimeOffset v) => v.GetHashCode(), (DateTimeOffset v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(12)", size: 12), converter: new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); dateTimeOffsetToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); dateTimeOffsetToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -718,6 +1142,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToStringConverter()); + dateTimeOffsetToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToStringConverterProperty, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[20]); + dateTimeOffsetToStringConverterProperty.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -753,6 +1198,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToBinaryConverter()); + dateTimeToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance) == default(DateTime)); + dateTimeToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToBinaryConverterProperty, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[21]); + dateTimeToBinaryConverterProperty.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToBinaryConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -783,6 +1249,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToStringConverter()); + dateTimeToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance) == default(DateTime)); + dateTimeToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToStringConverterProperty, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[22]); + dateTimeToStringConverterProperty.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -818,6 +1305,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTimeToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance) == default(DateTime)); + dateTimeToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToTicksConverterProperty, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[23]); + dateTimeToTicksConverterProperty.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToTicksConverterProperty.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -839,6 +1347,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Decimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0m); + @decimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance) == 0M); + @decimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetAccessors( + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@decimal, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue(@decimal), + (ValueBuffer valueBuffer) => valueBuffer[24]); + @decimal.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @decimal.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -859,6 +1388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + decimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance) == null); + decimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalArray, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalArray), + (ValueBuffer valueBuffer) => valueBuffer[25]); + decimalArray.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -902,6 +1452,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + decimalNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance) == 0M); + decimalNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToBytesConverterProperty, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[26]); + decimalNumberToBytesConverterProperty.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -912,20 +1483,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); decimalNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); decimalNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -935,6 +1506,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + decimalNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance) == 0M); + decimalNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToStringConverterProperty, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[27]); + decimalNumberToStringConverterProperty.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -970,6 +1562,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Double", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0.0); + @double.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance).Equals(0D)); + @double.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetAccessors( + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@double, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(@double), + (ValueBuffer valueBuffer) => valueBuffer[28]); + @double.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @double.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -990,6 +1603,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + doubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance) == null); + doubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleArray, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleArray), + (ValueBuffer valueBuffer) => valueBuffer[29]); + doubleArray.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1033,6 +1667,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + doubleNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance).Equals(0D)); + doubleNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToBytesConverterProperty, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[30]); + doubleNumberToBytesConverterProperty.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1043,20 +1698,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (double v) => v.GetHashCode(), (double v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(8)", size: 8), converter: new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); doubleNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }); doubleNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -1066,6 +1721,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + doubleNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance).Equals(0D)); + doubleNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToStringConverterProperty, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[31]); + doubleNumberToStringConverterProperty.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -1100,6 +1776,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16), + (ValueBuffer valueBuffer) => valueBuffer[32]); + enum16.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1129,6 +1826,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance) == null); + enum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16Array, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16Array), + (ValueBuffer valueBuffer) => valueBuffer[33]); + enum16Array.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1188,6 +1906,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16AsString(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16AsString(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsString, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[34]); + enum16AsString.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1222,6 +1961,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance) == null); + enum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsStringArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + enum16AsStringArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1285,6 +2045,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance) == null); + enum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16AsStringCollection, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[36]); + enum16AsStringCollection.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1348,6 +2129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance) == null); + enum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16Collection, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[37]); + enum16Collection.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1406,6 +2208,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32), + (ValueBuffer valueBuffer) => valueBuffer[38]); + enum32.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1435,6 +2258,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance) == null); + enum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32Array, 39), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32Array), + (ValueBuffer valueBuffer) => valueBuffer[39]); + enum32Array.SetPropertyIndexes( + index: 39, + originalValueIndex: 39, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1494,6 +2338,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32AsString(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32AsString(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsString, 40), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[40]); + enum32AsString.SetPropertyIndexes( + index: 40, + originalValueIndex: 40, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1528,6 +2393,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance) == null); + enum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsStringArray, 41), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[41]); + enum32AsStringArray.SetPropertyIndexes( + index: 41, + originalValueIndex: 41, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1591,6 +2477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance) == null); + enum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32AsStringCollection, 42), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[42]); + enum32AsStringCollection.SetPropertyIndexes( + index: 42, + originalValueIndex: 42, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1654,6 +2561,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance) == null); + enum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32Collection, 43), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[43]); + enum32Collection.SetPropertyIndexes( + index: 43, + originalValueIndex: 43, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1712,6 +2640,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64, 44), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64), + (ValueBuffer valueBuffer) => valueBuffer[44]); + enum64.SetPropertyIndexes( + index: 44, + originalValueIndex: 44, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1741,6 +2690,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance) == null); + enum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64Array, 45), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64Array), + (ValueBuffer valueBuffer) => valueBuffer[45]); + enum64Array.SetPropertyIndexes( + index: 45, + originalValueIndex: 45, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1800,6 +2770,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64AsString(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64AsString(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsString, 46), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[46]); + enum64AsString.SetPropertyIndexes( + index: 46, + originalValueIndex: 46, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1834,6 +2825,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance) == null); + enum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsStringArray, 47), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[47]); + enum64AsStringArray.SetPropertyIndexes( + index: 47, + originalValueIndex: 47, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1897,6 +2909,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance) == null); + enum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64AsStringCollection, 48), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[48]); + enum64AsStringCollection.SetPropertyIndexes( + index: 48, + originalValueIndex: 48, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1960,6 +2993,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance) == null); + enum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64Collection, 49), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[49]); + enum64Collection.SetPropertyIndexes( + index: 49, + originalValueIndex: 49, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -2018,6 +3072,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8, 50), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8), + (ValueBuffer valueBuffer) => valueBuffer[50]); + enum8.SetPropertyIndexes( + index: 50, + originalValueIndex: 50, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2047,6 +3122,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance) == null); + enum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8Array, 51), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8Array), + (ValueBuffer valueBuffer) => valueBuffer[51]); + enum8Array.SetPropertyIndexes( + index: 51, + originalValueIndex: 51, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2106,6 +3202,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8AsString(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8AsString(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsString, 52), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[52]); + enum8AsString.SetPropertyIndexes( + index: 52, + originalValueIndex: 52, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2140,6 +3257,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance) == null); + enum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsStringArray, 53), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[53]); + enum8AsStringArray.SetPropertyIndexes( + index: 53, + originalValueIndex: 53, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2203,6 +3341,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance) == null); + enum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8AsStringCollection, 54), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[54]); + enum8AsStringCollection.SetPropertyIndexes( + index: 54, + originalValueIndex: 54, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2266,6 +3425,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance) == null); + enum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8Collection, 55), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[55]); + enum8Collection.SetPropertyIndexes( + index: 55, + originalValueIndex: 55, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -2325,6 +3505,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToNumberConverter()); + enumToNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToNumberConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToNumberConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToNumberConverterProperty, 56), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[56]); + enumToNumberConverterProperty.SetPropertyIndexes( + index: 56, + originalValueIndex: 56, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2355,6 +3556,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToStringConverter()); + enumToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToStringConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToStringConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToStringConverterProperty, 57), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[57]); + enumToStringConverterProperty.SetPropertyIndexes( + index: 57, + originalValueIndex: 57, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2389,6 +3611,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16, 58), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16), + (ValueBuffer valueBuffer) => valueBuffer[58]); + enumU16.SetPropertyIndexes( + index: 58, + originalValueIndex: 58, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2418,6 +3661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance) == null); + enumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16Array, 59), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[59]); + enumU16Array.SetPropertyIndexes( + index: 59, + originalValueIndex: 59, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2477,6 +3741,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16AsString(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16AsString(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsString, 60), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[60]); + enumU16AsString.SetPropertyIndexes( + index: 60, + originalValueIndex: 60, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2511,6 +3796,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance) == null); + enumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsStringArray, 61), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[61]); + enumU16AsStringArray.SetPropertyIndexes( + index: 61, + originalValueIndex: 61, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2574,6 +3880,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance) == null); + enumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16AsStringCollection, 62), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[62]); + enumU16AsStringCollection.SetPropertyIndexes( + index: 62, + originalValueIndex: 62, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2637,6 +3964,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance) == null); + enumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16Collection, 63), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[63]); + enumU16Collection.SetPropertyIndexes( + index: 63, + originalValueIndex: 63, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2695,6 +4043,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32, 64), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32), + (ValueBuffer valueBuffer) => valueBuffer[64]); + enumU32.SetPropertyIndexes( + index: 64, + originalValueIndex: 64, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2724,6 +4093,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance) == null); + enumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32Array, 65), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[65]); + enumU32Array.SetPropertyIndexes( + index: 65, + originalValueIndex: 65, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2783,6 +4173,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32AsString(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32AsString(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsString, 66), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[66]); + enumU32AsString.SetPropertyIndexes( + index: 66, + originalValueIndex: 66, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2817,6 +4228,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance) == null); + enumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsStringArray, 67), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[67]); + enumU32AsStringArray.SetPropertyIndexes( + index: 67, + originalValueIndex: 67, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2880,6 +4312,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance) == null); + enumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32AsStringCollection, 68), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[68]); + enumU32AsStringCollection.SetPropertyIndexes( + index: 68, + originalValueIndex: 68, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2943,6 +4396,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance) == null); + enumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32Collection, 69), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[69]); + enumU32Collection.SetPropertyIndexes( + index: 69, + originalValueIndex: 69, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -3001,6 +4475,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64, 70), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64), + (ValueBuffer valueBuffer) => valueBuffer[70]); + enumU64.SetPropertyIndexes( + index: 70, + originalValueIndex: 70, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3034,6 +4529,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance) == null); + enumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64Array, 71), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[71]); + enumU64Array.SetPropertyIndexes( + index: 71, + originalValueIndex: 71, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3097,6 +4613,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64AsString(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64AsString(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsString, 72), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[72]); + enumU64AsString.SetPropertyIndexes( + index: 72, + originalValueIndex: 72, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3131,6 +4668,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance) == null); + enumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsStringArray, 73), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[73]); + enumU64AsStringArray.SetPropertyIndexes( + index: 73, + originalValueIndex: 73, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3194,6 +4752,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance) == null); + enumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64AsStringCollection, 74), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[74]); + enumU64AsStringCollection.SetPropertyIndexes( + index: 74, + originalValueIndex: 74, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3257,6 +4836,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance) == null); + enumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64Collection, 75), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[75]); + enumU64Collection.SetPropertyIndexes( + index: 75, + originalValueIndex: 75, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -3319,6 +4919,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8, 76), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8), + (ValueBuffer valueBuffer) => valueBuffer[76]); + enumU8.SetPropertyIndexes( + index: 76, + originalValueIndex: 76, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3348,6 +4969,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance) == null); + enumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8Array, 77), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[77]); + enumU8Array.SetPropertyIndexes( + index: 77, + originalValueIndex: 77, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3407,6 +5049,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8AsString(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8AsString(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsString, 78), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[78]); + enumU8AsString.SetPropertyIndexes( + index: 78, + originalValueIndex: 78, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3441,6 +5104,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance) == null); + enumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsStringArray, 79), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[79]); + enumU8AsStringArray.SetPropertyIndexes( + index: 79, + originalValueIndex: 79, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3504,6 +5188,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance) == null); + enumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8AsStringCollection, 80), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[80]); + enumU8AsStringCollection.SetPropertyIndexes( + index: 80, + originalValueIndex: 80, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3567,6 +5272,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance) == null); + enumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8Collection, 81), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[81]); + enumU8Collection.SetPropertyIndexes( + index: 81, + originalValueIndex: 81, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3626,6 +5352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Float", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0f); + @float.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity).Equals(0F), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance).Equals(0F)); + @float.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetAccessors( + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@float, 82), + (InternalEntityEntry entry) => entry.GetCurrentValue(@float), + (ValueBuffer valueBuffer) => valueBuffer[82]); + @float.SetPropertyIndexes( + index: 82, + originalValueIndex: 82, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @float.TypeMapping = SqlServerFloatTypeMapping.Default.Clone( comparer: new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3646,6 +5393,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("FloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + floatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance) == null); + floatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetAccessors( + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(floatArray, 83), + (InternalEntityEntry entry) => entry.GetCurrentValue(floatArray), + (ValueBuffer valueBuffer) => valueBuffer[83]); + floatArray.SetPropertyIndexes( + index: 83, + originalValueIndex: 83, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); floatArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3689,6 +5457,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Guid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetAccessors( + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guid, 84), + (InternalEntityEntry entry) => entry.GetCurrentValue(guid), + (ValueBuffer valueBuffer) => valueBuffer[84]); + guid.SetPropertyIndexes( + index: 84, + originalValueIndex: 84, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guid.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3711,6 +5500,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + guidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance) == null); + guidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetAccessors( + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidArray, 85), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidArray), + (ValueBuffer valueBuffer) => valueBuffer[85]); + guidArray.SetPropertyIndexes( + index: 85, + originalValueIndex: 85, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3756,6 +5566,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToBytesConverter()); + guidToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToBytesConverterProperty, 86), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[86]); + guidToBytesConverterProperty.SetPropertyIndexes( + index: 86, + originalValueIndex: 86, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3766,20 +5597,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v.GetHashCode(), (Guid v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)), + (byte[] v) => new Guid(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)))); + (byte[] v) => new Guid(v)))); guidToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); guidToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -3789,6 +5620,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToStringConverter()); + guidToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToStringConverterProperty, 87), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[87]); + guidToStringConverterProperty.SetPropertyIndexes( + index: 87, + originalValueIndex: 87, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3823,6 +5675,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance) == null); + iPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddress, 88), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddress), + (ValueBuffer valueBuffer) => valueBuffer[88]); + iPAddress.SetPropertyIndexes( + index: 88, + originalValueIndex: 88, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3856,6 +5729,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance) == null); + iPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressArray, 89), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[89]); + iPAddressArray.SetPropertyIndexes( + index: 89, + originalValueIndex: 89, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3920,6 +5814,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToBytesConverter()); + iPAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance) == null); + iPAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToBytesConverterProperty, 90), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[90]); + iPAddressToBytesConverterProperty.SetPropertyIndexes( + index: 90, + originalValueIndex: 90, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3930,20 +5845,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (IPAddress v) => v.GetHashCode(), (IPAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(16)", size: 16), converter: new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)), + (byte[] v) => new IPAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)))); + (byte[] v) => new IPAddress(v)))); iPAddressToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var iPAddressToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3952,6 +5867,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToStringConverter()); + iPAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance) == null); + iPAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToStringConverterProperty, 91), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[91]); + iPAddressToStringConverterProperty.SetPropertyIndexes( + index: 91, + originalValueIndex: 91, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3986,6 +5922,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); + int16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance) == 0); + int16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetAccessors( + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16, 92), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16), + (ValueBuffer valueBuffer) => valueBuffer[92]); + int16.SetPropertyIndexes( + index: 92, + originalValueIndex: 92, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (short v1, short v2) => v1 == v2, @@ -4006,6 +5963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance) == null); + int16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16Array, 93), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16Array), + (ValueBuffer valueBuffer) => valueBuffer[93]); + int16Array.SetPropertyIndexes( + index: 93, + originalValueIndex: 93, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -4049,6 +6027,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + int32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance) == 0); + int32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetAccessors( + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32, 94), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32), + (ValueBuffer valueBuffer) => valueBuffer[94]); + int32.SetPropertyIndexes( + index: 94, + originalValueIndex: 94, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4069,6 +6068,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance) == null); + int32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32Array, 95), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32Array), + (ValueBuffer valueBuffer) => valueBuffer[95]); + int32Array.SetPropertyIndexes( + index: 95, + originalValueIndex: 95, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4112,6 +6132,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0L); + int64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity) == 0L, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance) == 0L); + int64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetAccessors( + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64, 96), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64), + (ValueBuffer valueBuffer) => valueBuffer[96]); + int64.SetPropertyIndexes( + index: 96, + originalValueIndex: 96, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -4132,6 +6173,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance) == null); + int64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64Array, 97), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64Array), + (ValueBuffer valueBuffer) => valueBuffer[97]); + int64Array.SetPropertyIndexes( + index: 97, + originalValueIndex: 97, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (long v1, long v2) => v1 == v2, @@ -4174,6 +6236,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance) == 0); + int8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetAccessors( + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8, 98), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8), + (ValueBuffer valueBuffer) => valueBuffer[98]); + int8.SetPropertyIndexes( + index: 98, + originalValueIndex: 98, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -4203,6 +6286,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance) == null); + int8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8Array, 99), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8Array), + (ValueBuffer valueBuffer) => valueBuffer[99]); + int8Array.SetPropertyIndexes( + index: 99, + originalValueIndex: 99, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -4262,6 +6366,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + intNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance) == 0); + intNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToBytesConverterProperty, 100), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[100]); + intNumberToBytesConverterProperty.SetPropertyIndexes( + index: 100, + originalValueIndex: 100, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4272,20 +6397,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v, (int v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(4)", size: 4), converter: new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); intNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0 }); intNumberToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); @@ -4295,6 +6420,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + intNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance) == 0); + intNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToStringConverterProperty, 101), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[101]); + intNumberToStringConverterProperty.SetPropertyIndexes( + index: 101, + originalValueIndex: 101, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -4331,6 +6477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, valueConverter: new CompiledModelTestBase.NullIntToNullStringConverter()); + nullIntToNullStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullIntToNullStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullIntToNullStringConverterProperty(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullIntToNullStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullIntToNullStringConverterProperty(instance).HasValue); + nullIntToNullStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullIntToNullStringConverterProperty, 102), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullIntToNullStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[102]); + nullIntToNullStringConverterProperty.SetPropertyIndexes( + index: 102, + originalValueIndex: 102, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullIntToNullStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1 == v2, @@ -4367,6 +6534,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBool(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableBool(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBool(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableBool(instance).HasValue); + nullableBool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableBool, 103), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableBool), + (ValueBuffer valueBuffer) => valueBuffer[103]); + nullableBool.SetPropertyIndexes( + index: 103, + originalValueIndex: 103, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBool.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -4387,6 +6575,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBoolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance) == null); + nullableBoolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableBoolArray, 104), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableBoolArray), + (ValueBuffer valueBuffer) => valueBuffer[104]); + nullableBoolArray.SetPropertyIndexes( + index: 104, + originalValueIndex: 104, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBoolArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -4430,19 +6639,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance) == null); + nullableBytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytes, 105), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytes), + (ValueBuffer valueBuffer) => valueBuffer[105]); + nullableBytes.SetPropertyIndexes( + index: 105, + originalValueIndex: 105, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytes.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -4453,15 +6683,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance) == null); + nullableBytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytesArray, 106), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytesArray), + (ValueBuffer valueBuffer) => valueBuffer[106]); + nullableBytesArray.SetPropertyIndexes( + index: 106, + originalValueIndex: 106, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytesArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -4477,17 +6728,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas JsonByteArrayReaderWriter.Instance), elementMapping: SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None)); @@ -4499,6 +6750,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableChar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableChar.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableChar(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableChar(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableChar(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableChar(instance).HasValue); + nullableChar.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetAccessors( + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableChar, 107), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableChar), + (ValueBuffer valueBuffer) => valueBuffer[107]); + nullableChar.SetPropertyIndexes( + index: 107, + originalValueIndex: 107, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableChar.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -4532,6 +6804,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableCharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableCharArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance) == null); + nullableCharArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableCharArray, 108), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableCharArray), + (ValueBuffer valueBuffer) => valueBuffer[108]); + nullableCharArray.SetPropertyIndexes( + index: 108, + originalValueIndex: 108, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableCharArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -4596,6 +6889,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateOnly(instance).HasValue); + nullableDateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateOnly, 109), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateOnly), + (ValueBuffer valueBuffer) => valueBuffer[109]); + nullableDateOnly.SetPropertyIndexes( + index: 109, + originalValueIndex: 109, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnly.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -4616,6 +6930,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance) == null); + nullableDateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateOnlyArray, 110), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[110]); + nullableDateOnlyArray.SetPropertyIndexes( + index: 110, + originalValueIndex: 110, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -4659,6 +6994,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateTime(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateTime(instance).HasValue); + nullableDateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateTime, 111), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateTime), + (ValueBuffer valueBuffer) => valueBuffer[111]); + nullableDateTime.SetPropertyIndexes( + index: 111, + originalValueIndex: 111, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTime.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -4679,6 +7035,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance) == null); + nullableDateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateTimeArray, 112), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[112]); + nullableDateTimeArray.SetPropertyIndexes( + index: 112, + originalValueIndex: 112, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTimeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -4722,6 +7099,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDecimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDecimal(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDecimal(instance).HasValue); + nullableDecimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDecimal, 113), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDecimal), + (ValueBuffer valueBuffer) => valueBuffer[113]); + nullableDecimal.SetPropertyIndexes( + index: 113, + originalValueIndex: 113, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimal.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4742,6 +7140,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDecimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance) == null); + nullableDecimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDecimalArray, 114), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDecimalArray), + (ValueBuffer valueBuffer) => valueBuffer[114]); + nullableDecimalArray.SetPropertyIndexes( + index: 114, + originalValueIndex: 114, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimalArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4785,6 +7204,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDouble", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDouble.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDouble(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDouble(instance).HasValue); + nullableDouble.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDouble, 115), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDouble), + (ValueBuffer valueBuffer) => valueBuffer[115]); + nullableDouble.SetPropertyIndexes( + index: 115, + originalValueIndex: 115, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDouble.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4805,6 +7245,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDoubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance) == null); + nullableDoubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDoubleArray, 116), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDoubleArray), + (ValueBuffer valueBuffer) => valueBuffer[116]); + nullableDoubleArray.SetPropertyIndexes( + index: 116, + originalValueIndex: 116, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDoubleArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4848,6 +7309,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16(instance).HasValue); + nullableEnum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16, 117), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16), + (ValueBuffer valueBuffer) => valueBuffer[117]); + nullableEnum16.SetPropertyIndexes( + index: 117, + originalValueIndex: 117, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4876,6 +7358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance) == null); + nullableEnum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16Array, 118), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16Array), + (ValueBuffer valueBuffer) => valueBuffer[118]); + nullableEnum16Array.SetPropertyIndexes( + index: 118, + originalValueIndex: 118, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4935,6 +7438,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16AsString(instance).HasValue); + nullableEnum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16AsString, 119), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[119]); + nullableEnum16AsString.SetPropertyIndexes( + index: 119, + originalValueIndex: 119, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsString.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4963,6 +7487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance) == null); + nullableEnum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16AsStringArray, 120), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[120]); + nullableEnum16AsStringArray.SetPropertyIndexes( + index: 120, + originalValueIndex: 120, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5021,6 +7566,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance) == null); + nullableEnum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16AsStringCollection, 121), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[121]); + nullableEnum16AsStringCollection.SetPropertyIndexes( + index: 121, + originalValueIndex: 121, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5079,6 +7645,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance) == null); + nullableEnum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16Collection, 122), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[122]); + nullableEnum16Collection.SetPropertyIndexes( + index: 122, + originalValueIndex: 122, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -5138,6 +7725,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32(instance).HasValue); + nullableEnum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32, 123), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32), + (ValueBuffer valueBuffer) => valueBuffer[123]); + nullableEnum32.SetPropertyIndexes( + index: 123, + originalValueIndex: 123, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5166,6 +7774,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance) == null); + nullableEnum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32Array, 124), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32Array), + (ValueBuffer valueBuffer) => valueBuffer[124]); + nullableEnum32Array.SetPropertyIndexes( + index: 124, + originalValueIndex: 124, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5225,6 +7854,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32AsString(instance).HasValue); + nullableEnum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32AsString, 125), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[125]); + nullableEnum32AsString.SetPropertyIndexes( + index: 125, + originalValueIndex: 125, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5253,6 +7903,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance) == null); + nullableEnum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32AsStringArray, 126), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[126]); + nullableEnum32AsStringArray.SetPropertyIndexes( + index: 126, + originalValueIndex: 126, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5311,6 +7982,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance) == null); + nullableEnum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32AsStringCollection, 127), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[127]); + nullableEnum32AsStringCollection.SetPropertyIndexes( + index: 127, + originalValueIndex: 127, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5369,6 +8061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance) == null); + nullableEnum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32Collection, 128), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[128]); + nullableEnum32Collection.SetPropertyIndexes( + index: 128, + originalValueIndex: 128, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -5428,6 +8141,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64(instance).HasValue); + nullableEnum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64, 129), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64), + (ValueBuffer valueBuffer) => valueBuffer[129]); + nullableEnum64.SetPropertyIndexes( + index: 129, + originalValueIndex: 129, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5456,6 +8190,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance) == null); + nullableEnum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64Array, 130), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64Array), + (ValueBuffer valueBuffer) => valueBuffer[130]); + nullableEnum64Array.SetPropertyIndexes( + index: 130, + originalValueIndex: 130, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5515,6 +8270,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64AsString(instance).HasValue); + nullableEnum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64AsString, 131), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[131]); + nullableEnum64AsString.SetPropertyIndexes( + index: 131, + originalValueIndex: 131, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsString.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5543,6 +8319,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance) == null); + nullableEnum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64AsStringArray, 132), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[132]); + nullableEnum64AsStringArray.SetPropertyIndexes( + index: 132, + originalValueIndex: 132, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5601,6 +8398,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance) == null); + nullableEnum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64AsStringCollection, 133), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[133]); + nullableEnum64AsStringCollection.SetPropertyIndexes( + index: 133, + originalValueIndex: 133, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5659,6 +8477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance) == null); + nullableEnum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64Collection, 134), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[134]); + nullableEnum64Collection.SetPropertyIndexes( + index: 134, + originalValueIndex: 134, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -5718,6 +8557,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8(instance).HasValue); + nullableEnum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8, 135), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8), + (ValueBuffer valueBuffer) => valueBuffer[135]); + nullableEnum8.SetPropertyIndexes( + index: 135, + originalValueIndex: 135, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5746,6 +8606,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance) == null); + nullableEnum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8Array, 136), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8Array), + (ValueBuffer valueBuffer) => valueBuffer[136]); + nullableEnum8Array.SetPropertyIndexes( + index: 136, + originalValueIndex: 136, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5805,6 +8686,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8AsString(instance).HasValue); + nullableEnum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8AsString, 137), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[137]); + nullableEnum8AsString.SetPropertyIndexes( + index: 137, + originalValueIndex: 137, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsString.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5833,6 +8735,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance) == null); + nullableEnum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8AsStringArray, 138), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[138]); + nullableEnum8AsStringArray.SetPropertyIndexes( + index: 138, + originalValueIndex: 138, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5891,6 +8814,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance) == null); + nullableEnum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8AsStringCollection, 139), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[139]); + nullableEnum8AsStringCollection.SetPropertyIndexes( + index: 139, + originalValueIndex: 139, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5949,6 +8893,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance) == null); + nullableEnum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8Collection, 140), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[140]); + nullableEnum8Collection.SetPropertyIndexes( + index: 140, + originalValueIndex: 140, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -6008,6 +8973,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16(instance).HasValue); + nullableEnumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16, 141), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16), + (ValueBuffer valueBuffer) => valueBuffer[141]); + nullableEnumU16.SetPropertyIndexes( + index: 141, + originalValueIndex: 141, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6036,6 +9022,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance) == null); + nullableEnumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16Array, 142), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[142]); + nullableEnumU16Array.SetPropertyIndexes( + index: 142, + originalValueIndex: 142, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6095,6 +9102,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16AsString(instance).HasValue); + nullableEnumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16AsString, 143), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[143]); + nullableEnumU16AsString.SetPropertyIndexes( + index: 143, + originalValueIndex: 143, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6123,6 +9151,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance) == null); + nullableEnumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16AsStringArray, 144), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[144]); + nullableEnumU16AsStringArray.SetPropertyIndexes( + index: 144, + originalValueIndex: 144, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6181,6 +9230,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance) == null); + nullableEnumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16AsStringCollection, 145), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[145]); + nullableEnumU16AsStringCollection.SetPropertyIndexes( + index: 145, + originalValueIndex: 145, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6239,6 +9309,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance) == null); + nullableEnumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16Collection, 146), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[146]); + nullableEnumU16Collection.SetPropertyIndexes( + index: 146, + originalValueIndex: 146, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -6298,6 +9389,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32(instance).HasValue); + nullableEnumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32, 147), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32), + (ValueBuffer valueBuffer) => valueBuffer[147]); + nullableEnumU32.SetPropertyIndexes( + index: 147, + originalValueIndex: 147, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6326,6 +9438,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance) == null); + nullableEnumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32Array, 148), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[148]); + nullableEnumU32Array.SetPropertyIndexes( + index: 148, + originalValueIndex: 148, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6385,6 +9518,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32AsString(instance).HasValue); + nullableEnumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32AsString, 149), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[149]); + nullableEnumU32AsString.SetPropertyIndexes( + index: 149, + originalValueIndex: 149, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsString.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6413,6 +9567,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance) == null); + nullableEnumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32AsStringArray, 150), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[150]); + nullableEnumU32AsStringArray.SetPropertyIndexes( + index: 150, + originalValueIndex: 150, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6471,6 +9646,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance) == null); + nullableEnumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32AsStringCollection, 151), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[151]); + nullableEnumU32AsStringCollection.SetPropertyIndexes( + index: 151, + originalValueIndex: 151, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6529,6 +9725,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance) == null); + nullableEnumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32Collection, 152), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[152]); + nullableEnumU32Collection.SetPropertyIndexes( + index: 152, + originalValueIndex: 152, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -6588,6 +9805,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64(instance).HasValue); + nullableEnumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64, 153), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64), + (ValueBuffer valueBuffer) => valueBuffer[153]); + nullableEnumU64.SetPropertyIndexes( + index: 153, + originalValueIndex: 153, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6620,6 +9858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance) == null); + nullableEnumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64Array, 154), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[154]); + nullableEnumU64Array.SetPropertyIndexes( + index: 154, + originalValueIndex: 154, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6683,6 +9942,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64AsString(instance).HasValue); + nullableEnumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64AsString, 155), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[155]); + nullableEnumU64AsString.SetPropertyIndexes( + index: 155, + originalValueIndex: 155, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsString.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6715,6 +9995,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance) == null); + nullableEnumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64AsStringArray, 156), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[156]); + nullableEnumU64AsStringArray.SetPropertyIndexes( + index: 156, + originalValueIndex: 156, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6777,6 +10078,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance) == null); + nullableEnumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64AsStringCollection, 157), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[157]); + nullableEnumU64AsStringCollection.SetPropertyIndexes( + index: 157, + originalValueIndex: 157, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6839,6 +10161,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance) == null); + nullableEnumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64Collection, 158), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[158]); + nullableEnumU64Collection.SetPropertyIndexes( + index: 158, + originalValueIndex: 158, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6902,6 +10245,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8(instance).HasValue); + nullableEnumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8, 159), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8), + (ValueBuffer valueBuffer) => valueBuffer[159]); + nullableEnumU8.SetPropertyIndexes( + index: 159, + originalValueIndex: 159, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6930,6 +10294,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance) == null); + nullableEnumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8Array, 160), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[160]); + nullableEnumU8Array.SetPropertyIndexes( + index: 160, + originalValueIndex: 160, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6989,6 +10374,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8AsString(instance).HasValue); + nullableEnumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8AsString, 161), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[161]); + nullableEnumU8AsString.SetPropertyIndexes( + index: 161, + originalValueIndex: 161, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsString.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7017,6 +10423,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance) == null); + nullableEnumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8AsStringArray, 162), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[162]); + nullableEnumU8AsStringArray.SetPropertyIndexes( + index: 162, + originalValueIndex: 162, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7075,6 +10502,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance) == null); + nullableEnumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8AsStringCollection, 163), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[163]); + nullableEnumU8AsStringCollection.SetPropertyIndexes( + index: 163, + originalValueIndex: 163, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringCollection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7133,6 +10581,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance) == null); + nullableEnumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8Collection, 164), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[164]); + nullableEnumU8Collection.SetPropertyIndexes( + index: 164, + originalValueIndex: 164, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Collection.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -7192,6 +10661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloat", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableFloat.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableFloat(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableFloat(instance).HasValue); + nullableFloat.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableFloat, 165), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableFloat), + (ValueBuffer valueBuffer) => valueBuffer[165]); + nullableFloat.SetPropertyIndexes( + index: 165, + originalValueIndex: 165, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloat.TypeMapping = SqlServerFloatTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -7212,6 +10702,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableFloatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance) == null); + nullableFloatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableFloatArray, 166), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableFloatArray), + (ValueBuffer valueBuffer) => valueBuffer[166]); + nullableFloatArray.SetPropertyIndexes( + index: 166, + originalValueIndex: 166, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloatArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -7255,6 +10766,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableGuid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableGuid(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableGuid(instance).HasValue); + nullableGuid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableGuid, 167), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableGuid), + (ValueBuffer valueBuffer) => valueBuffer[167]); + nullableGuid.SetPropertyIndexes( + index: 167, + originalValueIndex: 167, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuid.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -7277,6 +10809,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableGuidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance) == null); + nullableGuidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableGuidArray, 168), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableGuidArray), + (ValueBuffer valueBuffer) => valueBuffer[168]); + nullableGuidArray.SetPropertyIndexes( + index: 168, + originalValueIndex: 168, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuidArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -7322,6 +10875,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableIPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance) == null); + nullableIPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddress, 169), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddress), + (ValueBuffer valueBuffer) => valueBuffer[169]); + nullableIPAddress.SetPropertyIndexes( + index: 169, + originalValueIndex: 169, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -7355,6 +10929,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableIPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance) == null); + nullableIPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddressArray, 170), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[170]); + nullableIPAddressArray.SetPropertyIndexes( + index: 170, + originalValueIndex: 170, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -7419,6 +11014,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt16(instance).HasValue); + nullableInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt16, 171), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt16), + (ValueBuffer valueBuffer) => valueBuffer[171]); + nullableInt16.SetPropertyIndexes( + index: 171, + originalValueIndex: 171, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -7439,6 +11055,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance) == null); + nullableInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt16Array, 172), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[172]); + nullableInt16Array.SetPropertyIndexes( + index: 172, + originalValueIndex: 172, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -7482,6 +11119,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt32(instance).HasValue); + nullableInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt32, 173), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt32), + (ValueBuffer valueBuffer) => valueBuffer[173]); + nullableInt32.SetPropertyIndexes( + index: 173, + originalValueIndex: 173, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -7502,6 +11160,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance) == null); + nullableInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt32Array, 174), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[174]); + nullableInt32Array.SetPropertyIndexes( + index: 174, + originalValueIndex: 174, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -7545,6 +11224,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt64(instance).HasValue); + nullableInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt64, 175), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt64), + (ValueBuffer valueBuffer) => valueBuffer[175]); + nullableInt64.SetPropertyIndexes( + index: 175, + originalValueIndex: 175, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -7565,6 +11265,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance) == null); + nullableInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt64Array, 176), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[176]); + nullableInt64Array.SetPropertyIndexes( + index: 176, + originalValueIndex: 176, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -7608,6 +11329,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt8(instance).HasValue); + nullableInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt8, 177), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt8), + (ValueBuffer valueBuffer) => valueBuffer[177]); + nullableInt8.SetPropertyIndexes( + index: 177, + originalValueIndex: 177, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8.TypeMapping = SqlServerShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -7636,6 +11378,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance) == null); + nullableInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt8Array, 178), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[178]); + nullableInt8Array.SetPropertyIndexes( + index: 178, + originalValueIndex: 178, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -7695,6 +11458,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullablePhysicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance) == null); + nullablePhysicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddress, 179), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[179]); + nullablePhysicalAddress.SetPropertyIndexes( + index: 179, + originalValueIndex: 179, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7728,6 +11512,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullablePhysicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance) == null); + nullablePhysicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddressArray, 180), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[180]); + nullablePhysicalAddressArray.SetPropertyIndexes( + index: 180, + originalValueIndex: 180, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7792,6 +11597,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance) == null); + nullableString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableString, 181), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableString), + (ValueBuffer valueBuffer) => valueBuffer[181]); + nullableString.SetPropertyIndexes( + index: 181, + originalValueIndex: 181, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableString.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7817,6 +11643,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance) == null); + nullableStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableStringArray, 182), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableStringArray), + (ValueBuffer valueBuffer) => valueBuffer[182]); + nullableStringArray.SetPropertyIndexes( + index: 182, + originalValueIndex: 182, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableStringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7865,6 +11712,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeOnly(instance).HasValue); + nullableTimeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeOnly, 183), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeOnly), + (ValueBuffer valueBuffer) => valueBuffer[183]); + nullableTimeOnly.SetPropertyIndexes( + index: 183, + originalValueIndex: 183, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnly.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -7885,6 +11753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance) == null); + nullableTimeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeOnlyArray, 184), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[184]); + nullableTimeOnlyArray.SetPropertyIndexes( + index: 184, + originalValueIndex: 184, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -7928,6 +11817,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeSpan(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeSpan(instance).HasValue); + nullableTimeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeSpan, 185), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeSpan), + (ValueBuffer valueBuffer) => valueBuffer[185]); + nullableTimeSpan.SetPropertyIndexes( + index: 185, + originalValueIndex: 185, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpan.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -7948,6 +11858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance) == null); + nullableTimeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeSpanArray, 186), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[186]); + nullableTimeSpanArray.SetPropertyIndexes( + index: 186, + originalValueIndex: 186, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpanArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -7991,6 +11922,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt16(instance).HasValue); + nullableUInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt16, 187), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt16), + (ValueBuffer valueBuffer) => valueBuffer[187]); + nullableUInt16.SetPropertyIndexes( + index: 187, + originalValueIndex: 187, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -8019,6 +11971,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance) == null); + nullableUInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt16Array, 188), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[188]); + nullableUInt16Array.SetPropertyIndexes( + index: 188, + originalValueIndex: 188, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -8078,6 +12051,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt32(instance).HasValue); + nullableUInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt32, 189), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt32), + (ValueBuffer valueBuffer) => valueBuffer[189]); + nullableUInt32.SetPropertyIndexes( + index: 189, + originalValueIndex: 189, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -8106,6 +12100,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance) == null); + nullableUInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt32Array, 190), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[190]); + nullableUInt32Array.SetPropertyIndexes( + index: 190, + originalValueIndex: 190, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -8165,6 +12180,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt64(instance).HasValue); + nullableUInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt64, 191), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt64), + (ValueBuffer valueBuffer) => valueBuffer[191]); + nullableUInt64.SetPropertyIndexes( + index: 191, + originalValueIndex: 191, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -8197,6 +12233,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance) == null); + nullableUInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt64Array, 192), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[192]); + nullableUInt64Array.SetPropertyIndexes( + index: 192, + originalValueIndex: 192, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -8260,6 +12317,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt8(instance).HasValue); + nullableUInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt8, 193), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt8), + (ValueBuffer valueBuffer) => valueBuffer[193]); + nullableUInt8.SetPropertyIndexes( + index: 193, + originalValueIndex: 193, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -8280,6 +12358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance) == null); + nullableUInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt8Array, 194), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[194]); + nullableUInt8Array.SetPropertyIndexes( + index: 194, + originalValueIndex: 194, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -8323,6 +12422,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance) == null); + nullableUri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUri, 195), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUri), + (ValueBuffer valueBuffer) => valueBuffer[195]); + nullableUri.SetPropertyIndexes( + index: 195, + originalValueIndex: 195, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUri.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8356,6 +12476,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance) == null); + nullableUriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUriArray, 196), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUriArray), + (ValueBuffer valueBuffer) => valueBuffer[196]); + nullableUriArray.SetPropertyIndexes( + index: 196, + originalValueIndex: 196, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUriArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8419,6 +12560,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance) == null); + physicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddress, 197), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[197]); + physicalAddress.SetPropertyIndexes( + index: 197, + originalValueIndex: 197, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddress.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8452,6 +12614,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance) == null); + physicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressArray, 198), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[198]); + physicalAddressArray.SetPropertyIndexes( + index: 198, + originalValueIndex: 198, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8516,6 +12699,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToBytesConverter()); + physicalAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance) == null); + physicalAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToBytesConverterProperty, 199), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[199]); + physicalAddressToBytesConverterProperty.SetPropertyIndexes( + index: 199, + originalValueIndex: 199, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8526,20 +12730,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (PhysicalAddress v) => v.GetHashCode(), (PhysicalAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(8)", size: 8), converter: new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)), + (byte[] v) => new PhysicalAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)))); + (byte[] v) => new PhysicalAddress(v)))); physicalAddressToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var physicalAddressToStringConverterProperty = runtimeEntityType.AddProperty( @@ -8548,6 +12752,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToStringConverter()); + physicalAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance) == null); + physicalAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToStringConverterProperty, 200), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[200]); + physicalAddressToStringConverterProperty.SetPropertyIndexes( + index: 200, + originalValueIndex: 200, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -8581,6 +12806,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("String", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @string.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance) == null); + @string.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetAccessors( + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@string, 201), + (InternalEntityEntry entry) => entry.GetCurrentValue(@string), + (ValueBuffer valueBuffer) => valueBuffer[201]); + @string.SetPropertyIndexes( + index: 201, + originalValueIndex: 201, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @string.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8606,6 +12852,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance) == null); + stringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetAccessors( + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringArray, 202), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringArray), + (ValueBuffer valueBuffer) => valueBuffer[202]); + stringArray.SetPropertyIndexes( + index: 202, + originalValueIndex: 202, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8654,6 +12921,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBoolConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToBoolConverter()); + stringToBoolConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance) == null); + stringToBoolConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBoolConverterProperty, 203), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBoolConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[203]); + stringToBoolConverterProperty.SetPropertyIndexes( + index: 203, + originalValueIndex: 203, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBoolConverterProperty.TypeMapping = SqlServerBoolTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8683,6 +12971,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + stringToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance) == null); + stringToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBytesConverterProperty, 204), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[204]); + stringToBytesConverterProperty.SetPropertyIndexes( + index: 204, + originalValueIndex: 204, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBytesConverterProperty.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8693,20 +13002,20 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), converter: new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)), + (byte[] v) => Encoding.UTF32.GetString(v)), storeTypePostfix: StoreTypePostfix.None, jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonByteArrayReaderWriter.Instance, new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)))); + (byte[] v) => Encoding.UTF32.GetString(v)))); stringToBytesConverterProperty.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var stringToCharConverterProperty = runtimeEntityType.AddProperty( @@ -8715,6 +13024,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToCharConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToCharConverter()); + stringToCharConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance) == null); + stringToCharConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToCharConverterProperty, 205), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToCharConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[205]); + stringToCharConverterProperty.SetPropertyIndexes( + index: 205, + originalValueIndex: 205, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToCharConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8749,6 +13079,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateOnlyConverter()); + stringToDateOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance) == null); + stringToDateOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateOnlyConverterProperty, 206), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[206]); + stringToDateOnlyConverterProperty.SetPropertyIndexes( + index: 206, + originalValueIndex: 206, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateOnlyConverterProperty.TypeMapping = SqlServerDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8780,6 +13131,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeConverter()); + stringToDateTimeConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance) == null); + stringToDateTimeConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeConverterProperty, 207), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[207]); + stringToDateTimeConverterProperty.SetPropertyIndexes( + index: 207, + originalValueIndex: 207, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeConverterProperty.TypeMapping = SqlServerDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8811,6 +13183,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeOffsetConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeOffsetConverter()); + stringToDateTimeOffsetConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance) == null); + stringToDateTimeOffsetConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeOffsetConverterProperty, 208), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeOffsetConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[208]); + stringToDateTimeOffsetConverterProperty.SetPropertyIndexes( + index: 208, + originalValueIndex: 208, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeOffsetConverterProperty.TypeMapping = SqlServerDateTimeOffsetTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8842,6 +13235,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDecimalNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDecimalNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance) == null); + stringToDecimalNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDecimalNumberConverterProperty, 209), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDecimalNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[209]); + stringToDecimalNumberConverterProperty.SetPropertyIndexes( + index: 209, + originalValueIndex: 209, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDecimalNumberConverterProperty.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8873,6 +13287,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDoubleNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDoubleNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance) == null); + stringToDoubleNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDoubleNumberConverterProperty, 210), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDoubleNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[210]); + stringToDoubleNumberConverterProperty.SetPropertyIndexes( + index: 210, + originalValueIndex: 210, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDoubleNumberConverterProperty.TypeMapping = SqlServerDoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8904,6 +13339,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToEnumConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToEnumConverter()); + stringToEnumConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance) == null); + stringToEnumConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToEnumConverterProperty, 211), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToEnumConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[211]); + stringToEnumConverterProperty.SetPropertyIndexes( + index: 211, + originalValueIndex: 211, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToEnumConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8932,6 +13388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToGuidConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringToGuidConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance) == null); + stringToGuidConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToGuidConverterProperty, 212), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToGuidConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[212]); + stringToGuidConverterProperty.SetPropertyIndexes( + index: 212, + originalValueIndex: 212, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToGuidConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8958,6 +13435,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToIntNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToIntNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance) == null); + stringToIntNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToIntNumberConverterProperty, 213), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToIntNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[213]); + stringToIntNumberConverterProperty.SetPropertyIndexes( + index: 213, + originalValueIndex: 213, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToIntNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -8989,6 +13487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeOnlyConverter()); + stringToTimeOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance) == null); + stringToTimeOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeOnlyConverterProperty, 214), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[214]); + stringToTimeOnlyConverterProperty.SetPropertyIndexes( + index: 214, + originalValueIndex: 214, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeOnlyConverterProperty.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9020,6 +13539,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeSpanConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeSpanConverter()); + stringToTimeSpanConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance) == null); + stringToTimeSpanConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeSpanConverterProperty, 215), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeSpanConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[215]); + stringToTimeSpanConverterProperty.SetPropertyIndexes( + index: 215, + originalValueIndex: 215, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeSpanConverterProperty.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9051,6 +13591,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToUriConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToUriConverter()); + stringToUriConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance) == null); + stringToUriConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToUriConverterProperty, 216), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToUriConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[216]); + stringToUriConverterProperty.SetPropertyIndexes( + index: 216, + originalValueIndex: 216, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToUriConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -9085,6 +13646,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeOnly(0, 0, 0)); + timeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance) == default(TimeOnly)); + timeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnly, 217), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnly), + (ValueBuffer valueBuffer) => valueBuffer[217]); + timeOnly.SetPropertyIndexes( + index: 217, + originalValueIndex: 217, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnly.TypeMapping = SqlServerTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9105,6 +13687,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance) == null); + timeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyArray, 218), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[218]); + timeOnlyArray.SetPropertyIndexes( + index: 218, + originalValueIndex: 218, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9148,6 +13751,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToStringConverter()); + timeOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance) == default(TimeOnly)); + timeOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToStringConverterProperty, 219), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[219]); + timeOnlyToStringConverterProperty.SetPropertyIndexes( + index: 219, + originalValueIndex: 219, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9183,6 +13807,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToTicksConverter()); + timeOnlyToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance) == default(TimeOnly)); + timeOnlyToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToTicksConverterProperty, 220), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[220]); + timeOnlyToTicksConverterProperty.SetPropertyIndexes( + index: 220, + originalValueIndex: 220, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToTicksConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -9213,6 +13858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeSpan(0, 0, 0, 0, 0)); + timeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance) == default(TimeSpan)); + timeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpan, 221), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpan), + (ValueBuffer valueBuffer) => valueBuffer[221]); + timeSpan.SetPropertyIndexes( + index: 221, + originalValueIndex: 221, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpan.TypeMapping = SqlServerTimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9233,6 +13899,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance) == null); + timeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanArray, 222), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[222]); + timeSpanArray.SetPropertyIndexes( + index: 222, + originalValueIndex: 222, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9276,6 +13963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToStringConverter()); + timeSpanToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance) == default(TimeSpan)); + timeSpanToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToStringConverterProperty, 223), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[223]); + timeSpanToStringConverterProperty.SetPropertyIndexes( + index: 223, + originalValueIndex: 223, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9311,6 +14019,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToTicksConverter()); + timeSpanToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance) == default(TimeSpan)); + timeSpanToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToTicksConverterProperty, 224), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[224]); + timeSpanToTicksConverterProperty.SetPropertyIndexes( + index: 224, + originalValueIndex: 224, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToTicksConverterProperty.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -9340,6 +14069,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance) == 0); + uInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16, 225), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16), + (ValueBuffer valueBuffer) => valueBuffer[225]); + uInt16.SetPropertyIndexes( + index: 225, + originalValueIndex: 225, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -9369,6 +14119,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance) == null); + uInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16Array, 226), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[226]); + uInt16Array.SetPropertyIndexes( + index: 226, + originalValueIndex: 226, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -9427,6 +14198,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity) == 0U, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance) == 0U); + uInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32, 227), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32), + (ValueBuffer valueBuffer) => valueBuffer[227]); + uInt32.SetPropertyIndexes( + index: 227, + originalValueIndex: 227, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -9456,6 +14248,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance) == null); + uInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32Array, 228), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[228]); + uInt32Array.SetPropertyIndexes( + index: 228, + originalValueIndex: 228, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -9514,6 +14327,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity) == 0UL, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance) == 0UL); + uInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64, 229), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64), + (ValueBuffer valueBuffer) => valueBuffer[229]); + uInt64.SetPropertyIndexes( + index: 229, + originalValueIndex: 229, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64.TypeMapping = SqlServerDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -9547,6 +14381,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance) == null); + uInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64Array, 230), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[230]); + uInt64Array.SetPropertyIndexes( + index: 230, + originalValueIndex: 230, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64Array.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -9610,6 +14465,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (byte)0); + uInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance) == 0); + uInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8, 231), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8), + (ValueBuffer valueBuffer) => valueBuffer[231]); + uInt8.SetPropertyIndexes( + index: 231, + originalValueIndex: 231, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -9630,19 +14506,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance) == null); + uInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8Array, 232), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[232]); + uInt8Array.SetPropertyIndexes( + index: 232, + originalValueIndex: 232, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8Array.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -9653,6 +14550,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Uri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance) == null); + uri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetAccessors( + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uri, 233), + (InternalEntityEntry entry) => entry.GetCurrentValue(uri), + (ValueBuffer valueBuffer) => valueBuffer[233]); + uri.SetPropertyIndexes( + index: 233, + originalValueIndex: 233, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uri.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9686,6 +14604,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance) == null); + uriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetAccessors( + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriArray, 234), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriArray), + (ValueBuffer valueBuffer) => valueBuffer[234]); + uriArray.SetPropertyIndexes( + index: 234, + originalValueIndex: 234, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9750,6 +14689,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new UriToStringConverter()); + uriToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance) == null); + uriToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriToStringConverterProperty, 235), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[235]); + uriToStringConverterProperty.SetPropertyIndexes( + index: 235, + originalValueIndex: 235, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriToStringConverterProperty.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -9787,6 +14747,284 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var @bool = runtimeEntityType.FindProperty("Bool")!; + var boolArray = runtimeEntityType.FindProperty("BoolArray")!; + var boolToStringConverterProperty = runtimeEntityType.FindProperty("BoolToStringConverterProperty")!; + var boolToTwoValuesConverterProperty = runtimeEntityType.FindProperty("BoolToTwoValuesConverterProperty")!; + var boolToZeroOneConverterProperty = runtimeEntityType.FindProperty("BoolToZeroOneConverterProperty")!; + var bytes = runtimeEntityType.FindProperty("Bytes")!; + var bytesArray = runtimeEntityType.FindProperty("BytesArray")!; + var bytesToStringConverterProperty = runtimeEntityType.FindProperty("BytesToStringConverterProperty")!; + var castingConverterProperty = runtimeEntityType.FindProperty("CastingConverterProperty")!; + var @char = runtimeEntityType.FindProperty("Char")!; + var charArray = runtimeEntityType.FindProperty("CharArray")!; + var charToStringConverterProperty = runtimeEntityType.FindProperty("CharToStringConverterProperty")!; + var dateOnly = runtimeEntityType.FindProperty("DateOnly")!; + var dateOnlyArray = runtimeEntityType.FindProperty("DateOnlyArray")!; + var dateOnlyToStringConverterProperty = runtimeEntityType.FindProperty("DateOnlyToStringConverterProperty")!; + var dateTime = runtimeEntityType.FindProperty("DateTime")!; + var dateTimeArray = runtimeEntityType.FindProperty("DateTimeArray")!; + var dateTimeOffsetToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBinaryConverterProperty")!; + var dateTimeOffsetToBytesConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBytesConverterProperty")!; + var dateTimeOffsetToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToStringConverterProperty")!; + var dateTimeToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeToBinaryConverterProperty")!; + var dateTimeToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeToStringConverterProperty")!; + var dateTimeToTicksConverterProperty = runtimeEntityType.FindProperty("DateTimeToTicksConverterProperty")!; + var @decimal = runtimeEntityType.FindProperty("Decimal")!; + var decimalArray = runtimeEntityType.FindProperty("DecimalArray")!; + var decimalNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToBytesConverterProperty")!; + var decimalNumberToStringConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToStringConverterProperty")!; + var @double = runtimeEntityType.FindProperty("Double")!; + var doubleArray = runtimeEntityType.FindProperty("DoubleArray")!; + var doubleNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToBytesConverterProperty")!; + var doubleNumberToStringConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToStringConverterProperty")!; + var enum16 = runtimeEntityType.FindProperty("Enum16")!; + var enum16Array = runtimeEntityType.FindProperty("Enum16Array")!; + var enum16AsString = runtimeEntityType.FindProperty("Enum16AsString")!; + var enum16AsStringArray = runtimeEntityType.FindProperty("Enum16AsStringArray")!; + var enum16AsStringCollection = runtimeEntityType.FindProperty("Enum16AsStringCollection")!; + var enum16Collection = runtimeEntityType.FindProperty("Enum16Collection")!; + var enum32 = runtimeEntityType.FindProperty("Enum32")!; + var enum32Array = runtimeEntityType.FindProperty("Enum32Array")!; + var enum32AsString = runtimeEntityType.FindProperty("Enum32AsString")!; + var enum32AsStringArray = runtimeEntityType.FindProperty("Enum32AsStringArray")!; + var enum32AsStringCollection = runtimeEntityType.FindProperty("Enum32AsStringCollection")!; + var enum32Collection = runtimeEntityType.FindProperty("Enum32Collection")!; + var enum64 = runtimeEntityType.FindProperty("Enum64")!; + var enum64Array = runtimeEntityType.FindProperty("Enum64Array")!; + var enum64AsString = runtimeEntityType.FindProperty("Enum64AsString")!; + var enum64AsStringArray = runtimeEntityType.FindProperty("Enum64AsStringArray")!; + var enum64AsStringCollection = runtimeEntityType.FindProperty("Enum64AsStringCollection")!; + var enum64Collection = runtimeEntityType.FindProperty("Enum64Collection")!; + var enum8 = runtimeEntityType.FindProperty("Enum8")!; + var enum8Array = runtimeEntityType.FindProperty("Enum8Array")!; + var enum8AsString = runtimeEntityType.FindProperty("Enum8AsString")!; + var enum8AsStringArray = runtimeEntityType.FindProperty("Enum8AsStringArray")!; + var enum8AsStringCollection = runtimeEntityType.FindProperty("Enum8AsStringCollection")!; + var enum8Collection = runtimeEntityType.FindProperty("Enum8Collection")!; + var enumToNumberConverterProperty = runtimeEntityType.FindProperty("EnumToNumberConverterProperty")!; + var enumToStringConverterProperty = runtimeEntityType.FindProperty("EnumToStringConverterProperty")!; + var enumU16 = runtimeEntityType.FindProperty("EnumU16")!; + var enumU16Array = runtimeEntityType.FindProperty("EnumU16Array")!; + var enumU16AsString = runtimeEntityType.FindProperty("EnumU16AsString")!; + var enumU16AsStringArray = runtimeEntityType.FindProperty("EnumU16AsStringArray")!; + var enumU16AsStringCollection = runtimeEntityType.FindProperty("EnumU16AsStringCollection")!; + var enumU16Collection = runtimeEntityType.FindProperty("EnumU16Collection")!; + var enumU32 = runtimeEntityType.FindProperty("EnumU32")!; + var enumU32Array = runtimeEntityType.FindProperty("EnumU32Array")!; + var enumU32AsString = runtimeEntityType.FindProperty("EnumU32AsString")!; + var enumU32AsStringArray = runtimeEntityType.FindProperty("EnumU32AsStringArray")!; + var enumU32AsStringCollection = runtimeEntityType.FindProperty("EnumU32AsStringCollection")!; + var enumU32Collection = runtimeEntityType.FindProperty("EnumU32Collection")!; + var enumU64 = runtimeEntityType.FindProperty("EnumU64")!; + var enumU64Array = runtimeEntityType.FindProperty("EnumU64Array")!; + var enumU64AsString = runtimeEntityType.FindProperty("EnumU64AsString")!; + var enumU64AsStringArray = runtimeEntityType.FindProperty("EnumU64AsStringArray")!; + var enumU64AsStringCollection = runtimeEntityType.FindProperty("EnumU64AsStringCollection")!; + var enumU64Collection = runtimeEntityType.FindProperty("EnumU64Collection")!; + var enumU8 = runtimeEntityType.FindProperty("EnumU8")!; + var enumU8Array = runtimeEntityType.FindProperty("EnumU8Array")!; + var enumU8AsString = runtimeEntityType.FindProperty("EnumU8AsString")!; + var enumU8AsStringArray = runtimeEntityType.FindProperty("EnumU8AsStringArray")!; + var enumU8AsStringCollection = runtimeEntityType.FindProperty("EnumU8AsStringCollection")!; + var enumU8Collection = runtimeEntityType.FindProperty("EnumU8Collection")!; + var @float = runtimeEntityType.FindProperty("Float")!; + var floatArray = runtimeEntityType.FindProperty("FloatArray")!; + var guid = runtimeEntityType.FindProperty("Guid")!; + var guidArray = runtimeEntityType.FindProperty("GuidArray")!; + var guidToBytesConverterProperty = runtimeEntityType.FindProperty("GuidToBytesConverterProperty")!; + var guidToStringConverterProperty = runtimeEntityType.FindProperty("GuidToStringConverterProperty")!; + var iPAddress = runtimeEntityType.FindProperty("IPAddress")!; + var iPAddressArray = runtimeEntityType.FindProperty("IPAddressArray")!; + var iPAddressToBytesConverterProperty = runtimeEntityType.FindProperty("IPAddressToBytesConverterProperty")!; + var iPAddressToStringConverterProperty = runtimeEntityType.FindProperty("IPAddressToStringConverterProperty")!; + var int16 = runtimeEntityType.FindProperty("Int16")!; + var int16Array = runtimeEntityType.FindProperty("Int16Array")!; + var int32 = runtimeEntityType.FindProperty("Int32")!; + var int32Array = runtimeEntityType.FindProperty("Int32Array")!; + var int64 = runtimeEntityType.FindProperty("Int64")!; + var int64Array = runtimeEntityType.FindProperty("Int64Array")!; + var int8 = runtimeEntityType.FindProperty("Int8")!; + var int8Array = runtimeEntityType.FindProperty("Int8Array")!; + var intNumberToBytesConverterProperty = runtimeEntityType.FindProperty("IntNumberToBytesConverterProperty")!; + var intNumberToStringConverterProperty = runtimeEntityType.FindProperty("IntNumberToStringConverterProperty")!; + var nullIntToNullStringConverterProperty = runtimeEntityType.FindProperty("NullIntToNullStringConverterProperty")!; + var nullableBool = runtimeEntityType.FindProperty("NullableBool")!; + var nullableBoolArray = runtimeEntityType.FindProperty("NullableBoolArray")!; + var nullableBytes = runtimeEntityType.FindProperty("NullableBytes")!; + var nullableBytesArray = runtimeEntityType.FindProperty("NullableBytesArray")!; + var nullableChar = runtimeEntityType.FindProperty("NullableChar")!; + var nullableCharArray = runtimeEntityType.FindProperty("NullableCharArray")!; + var nullableDateOnly = runtimeEntityType.FindProperty("NullableDateOnly")!; + var nullableDateOnlyArray = runtimeEntityType.FindProperty("NullableDateOnlyArray")!; + var nullableDateTime = runtimeEntityType.FindProperty("NullableDateTime")!; + var nullableDateTimeArray = runtimeEntityType.FindProperty("NullableDateTimeArray")!; + var nullableDecimal = runtimeEntityType.FindProperty("NullableDecimal")!; + var nullableDecimalArray = runtimeEntityType.FindProperty("NullableDecimalArray")!; + var nullableDouble = runtimeEntityType.FindProperty("NullableDouble")!; + var nullableDoubleArray = runtimeEntityType.FindProperty("NullableDoubleArray")!; + var nullableEnum16 = runtimeEntityType.FindProperty("NullableEnum16")!; + var nullableEnum16Array = runtimeEntityType.FindProperty("NullableEnum16Array")!; + var nullableEnum16AsString = runtimeEntityType.FindProperty("NullableEnum16AsString")!; + var nullableEnum16AsStringArray = runtimeEntityType.FindProperty("NullableEnum16AsStringArray")!; + var nullableEnum16AsStringCollection = runtimeEntityType.FindProperty("NullableEnum16AsStringCollection")!; + var nullableEnum16Collection = runtimeEntityType.FindProperty("NullableEnum16Collection")!; + var nullableEnum32 = runtimeEntityType.FindProperty("NullableEnum32")!; + var nullableEnum32Array = runtimeEntityType.FindProperty("NullableEnum32Array")!; + var nullableEnum32AsString = runtimeEntityType.FindProperty("NullableEnum32AsString")!; + var nullableEnum32AsStringArray = runtimeEntityType.FindProperty("NullableEnum32AsStringArray")!; + var nullableEnum32AsStringCollection = runtimeEntityType.FindProperty("NullableEnum32AsStringCollection")!; + var nullableEnum32Collection = runtimeEntityType.FindProperty("NullableEnum32Collection")!; + var nullableEnum64 = runtimeEntityType.FindProperty("NullableEnum64")!; + var nullableEnum64Array = runtimeEntityType.FindProperty("NullableEnum64Array")!; + var nullableEnum64AsString = runtimeEntityType.FindProperty("NullableEnum64AsString")!; + var nullableEnum64AsStringArray = runtimeEntityType.FindProperty("NullableEnum64AsStringArray")!; + var nullableEnum64AsStringCollection = runtimeEntityType.FindProperty("NullableEnum64AsStringCollection")!; + var nullableEnum64Collection = runtimeEntityType.FindProperty("NullableEnum64Collection")!; + var nullableEnum8 = runtimeEntityType.FindProperty("NullableEnum8")!; + var nullableEnum8Array = runtimeEntityType.FindProperty("NullableEnum8Array")!; + var nullableEnum8AsString = runtimeEntityType.FindProperty("NullableEnum8AsString")!; + var nullableEnum8AsStringArray = runtimeEntityType.FindProperty("NullableEnum8AsStringArray")!; + var nullableEnum8AsStringCollection = runtimeEntityType.FindProperty("NullableEnum8AsStringCollection")!; + var nullableEnum8Collection = runtimeEntityType.FindProperty("NullableEnum8Collection")!; + var nullableEnumU16 = runtimeEntityType.FindProperty("NullableEnumU16")!; + var nullableEnumU16Array = runtimeEntityType.FindProperty("NullableEnumU16Array")!; + var nullableEnumU16AsString = runtimeEntityType.FindProperty("NullableEnumU16AsString")!; + var nullableEnumU16AsStringArray = runtimeEntityType.FindProperty("NullableEnumU16AsStringArray")!; + var nullableEnumU16AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU16AsStringCollection")!; + var nullableEnumU16Collection = runtimeEntityType.FindProperty("NullableEnumU16Collection")!; + var nullableEnumU32 = runtimeEntityType.FindProperty("NullableEnumU32")!; + var nullableEnumU32Array = runtimeEntityType.FindProperty("NullableEnumU32Array")!; + var nullableEnumU32AsString = runtimeEntityType.FindProperty("NullableEnumU32AsString")!; + var nullableEnumU32AsStringArray = runtimeEntityType.FindProperty("NullableEnumU32AsStringArray")!; + var nullableEnumU32AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU32AsStringCollection")!; + var nullableEnumU32Collection = runtimeEntityType.FindProperty("NullableEnumU32Collection")!; + var nullableEnumU64 = runtimeEntityType.FindProperty("NullableEnumU64")!; + var nullableEnumU64Array = runtimeEntityType.FindProperty("NullableEnumU64Array")!; + var nullableEnumU64AsString = runtimeEntityType.FindProperty("NullableEnumU64AsString")!; + var nullableEnumU64AsStringArray = runtimeEntityType.FindProperty("NullableEnumU64AsStringArray")!; + var nullableEnumU64AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU64AsStringCollection")!; + var nullableEnumU64Collection = runtimeEntityType.FindProperty("NullableEnumU64Collection")!; + var nullableEnumU8 = runtimeEntityType.FindProperty("NullableEnumU8")!; + var nullableEnumU8Array = runtimeEntityType.FindProperty("NullableEnumU8Array")!; + var nullableEnumU8AsString = runtimeEntityType.FindProperty("NullableEnumU8AsString")!; + var nullableEnumU8AsStringArray = runtimeEntityType.FindProperty("NullableEnumU8AsStringArray")!; + var nullableEnumU8AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU8AsStringCollection")!; + var nullableEnumU8Collection = runtimeEntityType.FindProperty("NullableEnumU8Collection")!; + var nullableFloat = runtimeEntityType.FindProperty("NullableFloat")!; + var nullableFloatArray = runtimeEntityType.FindProperty("NullableFloatArray")!; + var nullableGuid = runtimeEntityType.FindProperty("NullableGuid")!; + var nullableGuidArray = runtimeEntityType.FindProperty("NullableGuidArray")!; + var nullableIPAddress = runtimeEntityType.FindProperty("NullableIPAddress")!; + var nullableIPAddressArray = runtimeEntityType.FindProperty("NullableIPAddressArray")!; + var nullableInt16 = runtimeEntityType.FindProperty("NullableInt16")!; + var nullableInt16Array = runtimeEntityType.FindProperty("NullableInt16Array")!; + var nullableInt32 = runtimeEntityType.FindProperty("NullableInt32")!; + var nullableInt32Array = runtimeEntityType.FindProperty("NullableInt32Array")!; + var nullableInt64 = runtimeEntityType.FindProperty("NullableInt64")!; + var nullableInt64Array = runtimeEntityType.FindProperty("NullableInt64Array")!; + var nullableInt8 = runtimeEntityType.FindProperty("NullableInt8")!; + var nullableInt8Array = runtimeEntityType.FindProperty("NullableInt8Array")!; + var nullablePhysicalAddress = runtimeEntityType.FindProperty("NullablePhysicalAddress")!; + var nullablePhysicalAddressArray = runtimeEntityType.FindProperty("NullablePhysicalAddressArray")!; + var nullableString = runtimeEntityType.FindProperty("NullableString")!; + var nullableStringArray = runtimeEntityType.FindProperty("NullableStringArray")!; + var nullableTimeOnly = runtimeEntityType.FindProperty("NullableTimeOnly")!; + var nullableTimeOnlyArray = runtimeEntityType.FindProperty("NullableTimeOnlyArray")!; + var nullableTimeSpan = runtimeEntityType.FindProperty("NullableTimeSpan")!; + var nullableTimeSpanArray = runtimeEntityType.FindProperty("NullableTimeSpanArray")!; + var nullableUInt16 = runtimeEntityType.FindProperty("NullableUInt16")!; + var nullableUInt16Array = runtimeEntityType.FindProperty("NullableUInt16Array")!; + var nullableUInt32 = runtimeEntityType.FindProperty("NullableUInt32")!; + var nullableUInt32Array = runtimeEntityType.FindProperty("NullableUInt32Array")!; + var nullableUInt64 = runtimeEntityType.FindProperty("NullableUInt64")!; + var nullableUInt64Array = runtimeEntityType.FindProperty("NullableUInt64Array")!; + var nullableUInt8 = runtimeEntityType.FindProperty("NullableUInt8")!; + var nullableUInt8Array = runtimeEntityType.FindProperty("NullableUInt8Array")!; + var nullableUri = runtimeEntityType.FindProperty("NullableUri")!; + var nullableUriArray = runtimeEntityType.FindProperty("NullableUriArray")!; + var physicalAddress = runtimeEntityType.FindProperty("PhysicalAddress")!; + var physicalAddressArray = runtimeEntityType.FindProperty("PhysicalAddressArray")!; + var physicalAddressToBytesConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToBytesConverterProperty")!; + var physicalAddressToStringConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToStringConverterProperty")!; + var @string = runtimeEntityType.FindProperty("String")!; + var stringArray = runtimeEntityType.FindProperty("StringArray")!; + var stringToBoolConverterProperty = runtimeEntityType.FindProperty("StringToBoolConverterProperty")!; + var stringToBytesConverterProperty = runtimeEntityType.FindProperty("StringToBytesConverterProperty")!; + var stringToCharConverterProperty = runtimeEntityType.FindProperty("StringToCharConverterProperty")!; + var stringToDateOnlyConverterProperty = runtimeEntityType.FindProperty("StringToDateOnlyConverterProperty")!; + var stringToDateTimeConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeConverterProperty")!; + var stringToDateTimeOffsetConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeOffsetConverterProperty")!; + var stringToDecimalNumberConverterProperty = runtimeEntityType.FindProperty("StringToDecimalNumberConverterProperty")!; + var stringToDoubleNumberConverterProperty = runtimeEntityType.FindProperty("StringToDoubleNumberConverterProperty")!; + var stringToEnumConverterProperty = runtimeEntityType.FindProperty("StringToEnumConverterProperty")!; + var stringToGuidConverterProperty = runtimeEntityType.FindProperty("StringToGuidConverterProperty")!; + var stringToIntNumberConverterProperty = runtimeEntityType.FindProperty("StringToIntNumberConverterProperty")!; + var stringToTimeOnlyConverterProperty = runtimeEntityType.FindProperty("StringToTimeOnlyConverterProperty")!; + var stringToTimeSpanConverterProperty = runtimeEntityType.FindProperty("StringToTimeSpanConverterProperty")!; + var stringToUriConverterProperty = runtimeEntityType.FindProperty("StringToUriConverterProperty")!; + var timeOnly = runtimeEntityType.FindProperty("TimeOnly")!; + var timeOnlyArray = runtimeEntityType.FindProperty("TimeOnlyArray")!; + var timeOnlyToStringConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToStringConverterProperty")!; + var timeOnlyToTicksConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToTicksConverterProperty")!; + var timeSpan = runtimeEntityType.FindProperty("TimeSpan")!; + var timeSpanArray = runtimeEntityType.FindProperty("TimeSpanArray")!; + var timeSpanToStringConverterProperty = runtimeEntityType.FindProperty("TimeSpanToStringConverterProperty")!; + var timeSpanToTicksConverterProperty = runtimeEntityType.FindProperty("TimeSpanToTicksConverterProperty")!; + var uInt16 = runtimeEntityType.FindProperty("UInt16")!; + var uInt16Array = runtimeEntityType.FindProperty("UInt16Array")!; + var uInt32 = runtimeEntityType.FindProperty("UInt32")!; + var uInt32Array = runtimeEntityType.FindProperty("UInt32Array")!; + var uInt64 = runtimeEntityType.FindProperty("UInt64")!; + var uInt64Array = runtimeEntityType.FindProperty("UInt64Array")!; + var uInt8 = runtimeEntityType.FindProperty("UInt8")!; + var uInt8Array = runtimeEntityType.FindProperty("UInt8Array")!; + var uri = runtimeEntityType.FindProperty("Uri")!; + var uriArray = runtimeEntityType.FindProperty("UriArray")!; + var uriToStringConverterProperty = runtimeEntityType.FindProperty("UriToStringConverterProperty")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg = (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)@bool.GetValueComparer()).Snapshot(source.GetCurrentValue(@bool)), (IEnumerable)source.GetCurrentValue(boolArray) == null ? null : (bool[])((ValueComparer>)boolArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(boolArray)), ((ValueComparer)boolToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToStringConverterProperty)), ((ValueComparer)boolToTwoValuesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToTwoValuesConverterProperty)), ((ValueComparer)boolToZeroOneConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToZeroOneConverterProperty)), source.GetCurrentValue(bytes) == null ? null : ((ValueComparer)bytes.GetValueComparer()).Snapshot(source.GetCurrentValue(bytes)), (IEnumerable)source.GetCurrentValue(bytesArray) == null ? null : (byte[][])((ValueComparer>)bytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(bytesArray)), source.GetCurrentValue(bytesToStringConverterProperty) == null ? null : ((ValueComparer)bytesToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(bytesToStringConverterProperty)), ((ValueComparer)castingConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(castingConverterProperty)), ((ValueComparer)@char.GetValueComparer()).Snapshot(source.GetCurrentValue(@char)), (IEnumerable)source.GetCurrentValue(charArray) == null ? null : (char[])((ValueComparer>)charArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(charArray)), ((ValueComparer)charToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(charToStringConverterProperty)), ((ValueComparer)dateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnly)), (IEnumerable)source.GetCurrentValue(dateOnlyArray) == null ? null : (DateOnly[])((ValueComparer>)dateOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateOnlyArray)), ((ValueComparer)dateOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnlyToStringConverterProperty)), ((ValueComparer)dateTime.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTime)), (IEnumerable)source.GetCurrentValue(dateTimeArray) == null ? null : (DateTime[])((ValueComparer>)dateTimeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateTimeArray)), ((ValueComparer)dateTimeOffsetToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty)), ((ValueComparer)dateTimeOffsetToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBytesConverterProperty)), ((ValueComparer)dateTimeOffsetToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToStringConverterProperty)), ((ValueComparer)dateTimeToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToBinaryConverterProperty)), ((ValueComparer)dateTimeToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToStringConverterProperty)), ((ValueComparer)dateTimeToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToTicksConverterProperty)), ((ValueComparer)@decimal.GetValueComparer()).Snapshot(source.GetCurrentValue(@decimal)), (IEnumerable)source.GetCurrentValue(decimalArray) == null ? null : (decimal[])((ValueComparer>)decimalArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(decimalArray)), ((ValueComparer)decimalNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToBytesConverterProperty)), ((ValueComparer)decimalNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToStringConverterProperty)), ((ValueComparer)@double.GetValueComparer()).Snapshot(source.GetCurrentValue(@double)), (IEnumerable)source.GetCurrentValue(doubleArray) == null ? null : (double[])((ValueComparer>)doubleArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(doubleArray))); + var entity0 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], List, List, CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], List, List, CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], List, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32, CompiledModelTestBase.EnumU16, CompiledModelTestBase.EnumU16[]>(((ValueComparer)doubleNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToBytesConverterProperty)), ((ValueComparer)doubleNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToStringConverterProperty)), ((ValueComparer)enum16.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16)), (IEnumerable)source.GetCurrentValue(enum16Array) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16Array)), ((ValueComparer)enum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16AsString)), (IEnumerable)source.GetCurrentValue(enum16AsStringArray) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum16AsStringCollection) == null ? null : (List)((ValueComparer>)enum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum16Collection) == null ? null : (List)((ValueComparer>)enum16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16Collection)), ((ValueComparer)enum32.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32)), (IEnumerable)source.GetCurrentValue(enum32Array) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32Array)), ((ValueComparer)enum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32AsString)), (IEnumerable)source.GetCurrentValue(enum32AsStringArray) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum32AsStringCollection) == null ? null : (List)((ValueComparer>)enum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum32Collection) == null ? null : (List)((ValueComparer>)enum32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32Collection)), ((ValueComparer)enum64.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64)), (IEnumerable)source.GetCurrentValue(enum64Array) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64Array)), ((ValueComparer)enum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64AsString)), (IEnumerable)source.GetCurrentValue(enum64AsStringArray) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum64AsStringCollection) == null ? null : (List)((ValueComparer>)enum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum64Collection) == null ? null : (List)((ValueComparer>)enum64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64Collection)), ((ValueComparer)enum8.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8)), (IEnumerable)source.GetCurrentValue(enum8Array) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8Array)), ((ValueComparer)enum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8AsString)), (IEnumerable)source.GetCurrentValue(enum8AsStringArray) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum8AsStringCollection) == null ? null : (List)((ValueComparer>)enum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum8Collection) == null ? null : (List)((ValueComparer>)enum8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8Collection)), ((ValueComparer)enumToNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToNumberConverterProperty)), ((ValueComparer)enumToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToStringConverterProperty)), ((ValueComparer)enumU16.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16)), (IEnumerable)source.GetCurrentValue(enumU16Array) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16Array))); + var entity1 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg1 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], List, List, CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], List, List, CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], List, List, float, float[], Guid, Guid[], Guid, Guid, IPAddress, IPAddress[]>(((ValueComparer)enumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16AsString)), (IEnumerable)source.GetCurrentValue(enumU16AsStringArray) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection) == null ? null : (List)((ValueComparer>)enumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU16Collection) == null ? null : (List)((ValueComparer>)enumU16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16Collection)), ((ValueComparer)enumU32.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32)), (IEnumerable)source.GetCurrentValue(enumU32Array) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32Array)), ((ValueComparer)enumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32AsString)), (IEnumerable)source.GetCurrentValue(enumU32AsStringArray) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection) == null ? null : (List)((ValueComparer>)enumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU32Collection) == null ? null : (List)((ValueComparer>)enumU32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32Collection)), ((ValueComparer)enumU64.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64)), (IEnumerable)source.GetCurrentValue(enumU64Array) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64Array)), ((ValueComparer)enumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64AsString)), (IEnumerable)source.GetCurrentValue(enumU64AsStringArray) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection) == null ? null : (List)((ValueComparer>)enumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU64Collection) == null ? null : (List)((ValueComparer>)enumU64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64Collection)), ((ValueComparer)enumU8.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8)), (IEnumerable)source.GetCurrentValue(enumU8Array) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8Array)), ((ValueComparer)enumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8AsString)), (IEnumerable)source.GetCurrentValue(enumU8AsStringArray) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection) == null ? null : (List)((ValueComparer>)enumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU8Collection) == null ? null : (List)((ValueComparer>)enumU8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8Collection)), ((ValueComparer)@float.GetValueComparer()).Snapshot(source.GetCurrentValue(@float)), (IEnumerable)source.GetCurrentValue(floatArray) == null ? null : (float[])((ValueComparer>)floatArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(floatArray)), ((ValueComparer)guid.GetValueComparer()).Snapshot(source.GetCurrentValue(guid)), (IEnumerable)source.GetCurrentValue(guidArray) == null ? null : (Guid[])((ValueComparer>)guidArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(guidArray)), ((ValueComparer)guidToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToBytesConverterProperty)), ((ValueComparer)guidToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToStringConverterProperty)), source.GetCurrentValue(iPAddress) == null ? null : ((ValueComparer)iPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddress)), (IEnumerable)source.GetCurrentValue(iPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)iPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(iPAddressArray))); + var entity2 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg2 = (ISnapshot)new Snapshot, Nullable, Nullable[], byte[], byte[][], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable>(source.GetCurrentValue(iPAddressToBytesConverterProperty) == null ? null : ((ValueComparer)iPAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToBytesConverterProperty)), source.GetCurrentValue(iPAddressToStringConverterProperty) == null ? null : ((ValueComparer)iPAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToStringConverterProperty)), ((ValueComparer)int16.GetValueComparer()).Snapshot(source.GetCurrentValue(int16)), (IEnumerable)source.GetCurrentValue(int16Array) == null ? null : (short[])((ValueComparer>)int16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int16Array)), ((ValueComparer)int32.GetValueComparer()).Snapshot(source.GetCurrentValue(int32)), (IEnumerable)source.GetCurrentValue(int32Array) == null ? null : (int[])((ValueComparer>)int32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int32Array)), ((ValueComparer)int64.GetValueComparer()).Snapshot(source.GetCurrentValue(int64)), (IEnumerable)source.GetCurrentValue(int64Array) == null ? null : (long[])((ValueComparer>)int64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int64Array)), ((ValueComparer)int8.GetValueComparer()).Snapshot(source.GetCurrentValue(int8)), (IEnumerable)source.GetCurrentValue(int8Array) == null ? null : (sbyte[])((ValueComparer>)int8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int8Array)), ((ValueComparer)intNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToBytesConverterProperty)), ((ValueComparer)intNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToStringConverterProperty)), source.GetCurrentValue>(nullIntToNullStringConverterProperty) == null ? null : ((ValueComparer>)nullIntToNullStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullIntToNullStringConverterProperty)), source.GetCurrentValue>(nullableBool) == null ? null : ((ValueComparer>)nullableBool.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableBool)), (IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray) == null ? null : (Nullable[])((ValueComparer>>)nullableBoolArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray)), source.GetCurrentValue(nullableBytes) == null ? null : ((ValueComparer)nullableBytes.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableBytes)), (IEnumerable)source.GetCurrentValue(nullableBytesArray) == null ? null : (byte[][])((ValueComparer>)nullableBytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableBytesArray)), source.GetCurrentValue>(nullableChar) == null ? null : ((ValueComparer>)nullableChar.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableChar)), (IEnumerable>)source.GetCurrentValue[]>(nullableCharArray) == null ? null : (Nullable[])((ValueComparer>>)nullableCharArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableCharArray)), source.GetCurrentValue>(nullableDateOnly) == null ? null : ((ValueComparer>)nullableDateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray)), source.GetCurrentValue>(nullableDateTime) == null ? null : ((ValueComparer>)nullableDateTime.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateTime)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateTimeArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray)), source.GetCurrentValue>(nullableDecimal) == null ? null : ((ValueComparer>)nullableDecimal.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDecimal)), (IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDecimalArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray)), source.GetCurrentValue>(nullableDouble) == null ? null : ((ValueComparer>)nullableDouble.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDouble)), (IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDoubleArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray)), source.GetCurrentValue>(nullableEnum16) == null ? null : ((ValueComparer>)nullableEnum16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array)), source.GetCurrentValue>(nullableEnum16AsString) == null ? null : ((ValueComparer>)nullableEnum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16AsString))); + var entity3 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg3 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable>((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection)), source.GetCurrentValue>(nullableEnum32) == null ? null : ((ValueComparer>)nullableEnum32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array)), source.GetCurrentValue>(nullableEnum32AsString) == null ? null : ((ValueComparer>)nullableEnum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection)), source.GetCurrentValue>(nullableEnum64) == null ? null : ((ValueComparer>)nullableEnum64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array)), source.GetCurrentValue>(nullableEnum64AsString) == null ? null : ((ValueComparer>)nullableEnum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection)), source.GetCurrentValue>(nullableEnum8) == null ? null : ((ValueComparer>)nullableEnum8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array)), source.GetCurrentValue>(nullableEnum8AsString) == null ? null : ((ValueComparer>)nullableEnum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection)), source.GetCurrentValue>(nullableEnumU16) == null ? null : ((ValueComparer>)nullableEnumU16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array)), source.GetCurrentValue>(nullableEnumU16AsString) == null ? null : ((ValueComparer>)nullableEnumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection)), source.GetCurrentValue>(nullableEnumU32) == null ? null : ((ValueComparer>)nullableEnumU32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array)), source.GetCurrentValue>(nullableEnumU32AsString) == null ? null : ((ValueComparer>)nullableEnumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32AsString))); + var entity4 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg4 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], IPAddress, IPAddress[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], PhysicalAddress>((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection)), source.GetCurrentValue>(nullableEnumU64) == null ? null : ((ValueComparer>)nullableEnumU64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array)), source.GetCurrentValue>(nullableEnumU64AsString) == null ? null : ((ValueComparer>)nullableEnumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection)), source.GetCurrentValue>(nullableEnumU8) == null ? null : ((ValueComparer>)nullableEnumU8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array)), source.GetCurrentValue>(nullableEnumU8AsString) == null ? null : ((ValueComparer>)nullableEnumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection)), source.GetCurrentValue>(nullableFloat) == null ? null : ((ValueComparer>)nullableFloat.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableFloat)), (IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray) == null ? null : (Nullable[])((ValueComparer>>)nullableFloatArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray)), source.GetCurrentValue>(nullableGuid) == null ? null : ((ValueComparer>)nullableGuid.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableGuid)), (IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray) == null ? null : (Nullable[])((ValueComparer>>)nullableGuidArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray)), source.GetCurrentValue(nullableIPAddress) == null ? null : ((ValueComparer)nullableIPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableIPAddress)), (IEnumerable)source.GetCurrentValue(nullableIPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)nullableIPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableIPAddressArray)), source.GetCurrentValue>(nullableInt16) == null ? null : ((ValueComparer>)nullableInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array)), source.GetCurrentValue>(nullableInt32) == null ? null : ((ValueComparer>)nullableInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array)), source.GetCurrentValue>(nullableInt64) == null ? null : ((ValueComparer>)nullableInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array)), source.GetCurrentValue>(nullableInt8) == null ? null : ((ValueComparer>)nullableInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array)), source.GetCurrentValue(nullablePhysicalAddress) == null ? null : ((ValueComparer)nullablePhysicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullablePhysicalAddress))); + var entity5 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg5 = (ISnapshot)new Snapshot, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Uri, Uri[], PhysicalAddress, PhysicalAddress[], PhysicalAddress, PhysicalAddress, string, string[], string, string, string, string, string, string, string>((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)nullablePhysicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray)), source.GetCurrentValue(nullableString) == null ? null : ((ValueComparer)nullableString.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableString)), (IEnumerable)source.GetCurrentValue(nullableStringArray) == null ? null : (string[])((ValueComparer>)nullableStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableStringArray)), source.GetCurrentValue>(nullableTimeOnly) == null ? null : ((ValueComparer>)nullableTimeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray)), source.GetCurrentValue>(nullableTimeSpan) == null ? null : ((ValueComparer>)nullableTimeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeSpan)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeSpanArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray)), source.GetCurrentValue>(nullableUInt16) == null ? null : ((ValueComparer>)nullableUInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array)), source.GetCurrentValue>(nullableUInt32) == null ? null : ((ValueComparer>)nullableUInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array)), source.GetCurrentValue>(nullableUInt64) == null ? null : ((ValueComparer>)nullableUInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array)), source.GetCurrentValue>(nullableUInt8) == null ? null : ((ValueComparer>)nullableUInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array)), source.GetCurrentValue(nullableUri) == null ? null : ((ValueComparer)nullableUri.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableUri)), (IEnumerable)source.GetCurrentValue(nullableUriArray) == null ? null : (Uri[])((ValueComparer>)nullableUriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableUriArray)), source.GetCurrentValue(physicalAddress) == null ? null : ((ValueComparer)physicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddress)), (IEnumerable)source.GetCurrentValue(physicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)physicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(physicalAddressArray)), source.GetCurrentValue(physicalAddressToBytesConverterProperty) == null ? null : ((ValueComparer)physicalAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToBytesConverterProperty)), source.GetCurrentValue(physicalAddressToStringConverterProperty) == null ? null : ((ValueComparer)physicalAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToStringConverterProperty)), source.GetCurrentValue(@string) == null ? null : ((ValueComparer)@string.GetValueComparer()).Snapshot(source.GetCurrentValue(@string)), (IEnumerable)source.GetCurrentValue(stringArray) == null ? null : (string[])((ValueComparer>)stringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(stringArray)), source.GetCurrentValue(stringToBoolConverterProperty) == null ? null : ((ValueComparer)stringToBoolConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBoolConverterProperty)), source.GetCurrentValue(stringToBytesConverterProperty) == null ? null : ((ValueComparer)stringToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBytesConverterProperty)), source.GetCurrentValue(stringToCharConverterProperty) == null ? null : ((ValueComparer)stringToCharConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToCharConverterProperty)), source.GetCurrentValue(stringToDateOnlyConverterProperty) == null ? null : ((ValueComparer)stringToDateOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateOnlyConverterProperty)), source.GetCurrentValue(stringToDateTimeConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeConverterProperty)), source.GetCurrentValue(stringToDateTimeOffsetConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeOffsetConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeOffsetConverterProperty)), source.GetCurrentValue(stringToDecimalNumberConverterProperty) == null ? null : ((ValueComparer)stringToDecimalNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDecimalNumberConverterProperty))); + var entity6 = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, liftedArg0, liftedArg1, liftedArg2, liftedArg3, liftedArg4, liftedArg5, (ISnapshot)new Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty) == null ? null : ((ValueComparer)stringToDoubleNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty)), source.GetCurrentValue(stringToEnumConverterProperty) == null ? null : ((ValueComparer)stringToEnumConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToEnumConverterProperty)), source.GetCurrentValue(stringToGuidConverterProperty) == null ? null : ((ValueComparer)stringToGuidConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToGuidConverterProperty)), source.GetCurrentValue(stringToIntNumberConverterProperty) == null ? null : ((ValueComparer)stringToIntNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToIntNumberConverterProperty)), source.GetCurrentValue(stringToTimeOnlyConverterProperty) == null ? null : ((ValueComparer)stringToTimeOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeOnlyConverterProperty)), source.GetCurrentValue(stringToTimeSpanConverterProperty) == null ? null : ((ValueComparer)stringToTimeSpanConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeSpanConverterProperty)), source.GetCurrentValue(stringToUriConverterProperty) == null ? null : ((ValueComparer)stringToUriConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToUriConverterProperty)), ((ValueComparer)timeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnly)), (IEnumerable)source.GetCurrentValue(timeOnlyArray) == null ? null : (TimeOnly[])((ValueComparer>)timeOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeOnlyArray)), ((ValueComparer)timeOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToStringConverterProperty)), ((ValueComparer)timeOnlyToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToTicksConverterProperty)), ((ValueComparer)timeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpan)), (IEnumerable)source.GetCurrentValue(timeSpanArray) == null ? null : (TimeSpan[])((ValueComparer>)timeSpanArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeSpanArray)), ((ValueComparer)timeSpanToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToStringConverterProperty)), ((ValueComparer)timeSpanToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToTicksConverterProperty)), ((ValueComparer)uInt16.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt16)), (IEnumerable)source.GetCurrentValue(uInt16Array) == null ? null : (ushort[])((ValueComparer>)uInt16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt16Array)), ((ValueComparer)uInt32.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt32)), (IEnumerable)source.GetCurrentValue(uInt32Array) == null ? null : (uint[])((ValueComparer>)uInt32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt32Array)), ((ValueComparer)uInt64.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt64)), (IEnumerable)source.GetCurrentValue(uInt64Array) == null ? null : (ulong[])((ValueComparer>)uInt64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt64Array)), ((ValueComparer)uInt8.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8)), source.GetCurrentValue(uInt8Array) == null ? null : ((ValueComparer)uInt8Array.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8Array)), source.GetCurrentValue(uri) == null ? null : ((ValueComparer)uri.GetValueComparer()).Snapshot(source.GetCurrentValue(uri)), (IEnumerable)source.GetCurrentValue(uriArray) == null ? null : (Uri[])((ValueComparer>)uriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uriArray)), source.GetCurrentValue(uriToStringConverterProperty) == null ? null : ((ValueComparer)uriToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(uriToStringConverterProperty))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(CompiledModelTestBase.ManyTypesId)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(CompiledModelTestBase.ManyTypesId))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 236, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 236, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -9798,5 +15036,2129 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.ManyTypesId GetId(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.ManyTypesId ReadId(CompiledModelTestBase.ManyTypes @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.ManyTypesId value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBool(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBool(CompiledModelTestBase.ManyTypes @this) + => GetBool(@this); + + public static void WriteBool(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool[] GetBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool[] ReadBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetBoolArray(@this); + + public static void WriteBoolArray(CompiledModelTestBase.ManyTypes @this, bool[] value) + => GetBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToStringConverterProperty(@this); + + public static void WriteBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToTwoValuesConverterProperty(@this); + + public static void WriteBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToTwoValuesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToZeroOneConverterProperty(@this); + + public static void WriteBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToZeroOneConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytes(CompiledModelTestBase.ManyTypes @this) + => GetBytes(@this); + + public static void WriteBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetBytesArray(@this); + + public static void WriteBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBytesToStringConverterProperty(@this); + + public static void WriteBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytesToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetCastingConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadCastingConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCastingConverterProperty(@this); + + public static void WriteCastingConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetCastingConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetChar(CompiledModelTestBase.ManyTypes @this); + + public static char ReadChar(CompiledModelTestBase.ManyTypes @this) + => GetChar(@this); + + public static void WriteChar(CompiledModelTestBase.ManyTypes @this, char value) + => GetChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char[] GetCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char[] ReadCharArray(CompiledModelTestBase.ManyTypes @this) + => GetCharArray(@this); + + public static void WriteCharArray(CompiledModelTestBase.ManyTypes @this, char[] value) + => GetCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static char ReadCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCharToStringConverterProperty(@this); + + public static void WriteCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, char value) + => GetCharToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetDateOnly(@this); + + public static void WriteDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly[] GetDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly[] ReadDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyArray(@this); + + public static void WriteDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly[] value) + => GetDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyToStringConverterProperty(@this); + + public static void WriteDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTime(CompiledModelTestBase.ManyTypes @this) + => GetDateTime(@this); + + public static void WriteDateTime(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime[] ReadDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeArray(@this); + + public static void WriteDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime[] value) + => GetDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBinaryConverterProperty(@this); + + public static void WriteDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBytesConverterProperty(@this); + + public static void WriteDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToStringConverterProperty(@this); + + public static void WriteDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToBinaryConverterProperty(@this); + + public static void WriteDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToStringConverterProperty(@this); + + public static void WriteDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToTicksConverterProperty(@this); + + public static void WriteDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimal(CompiledModelTestBase.ManyTypes @this) + => GetDecimal(@this); + + public static void WriteDecimal(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal[] GetDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal[] ReadDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetDecimalArray(@this); + + public static void WriteDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal[] value) + => GetDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToBytesConverterProperty(@this); + + public static void WriteDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToStringConverterProperty(@this); + + public static void WriteDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDouble(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDouble(CompiledModelTestBase.ManyTypes @this) + => GetDouble(@this); + + public static void WriteDouble(CompiledModelTestBase.ManyTypes @this, double value) + => GetDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double[] GetDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double[] ReadDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetDoubleArray(@this); + + public static void WriteDoubleArray(CompiledModelTestBase.ManyTypes @this, double[] value) + => GetDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToBytesConverterProperty(@this); + + public static void WriteDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToStringConverterProperty(@this); + + public static void WriteDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16(CompiledModelTestBase.ManyTypes @this) + => GetEnum16(@this); + + public static void WriteEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Array(@this); + + public static void WriteEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsString(@this); + + public static void WriteEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringArray(@this); + + public static void WriteEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringCollection(@this); + + public static void WriteEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Collection(@this); + + public static void WriteEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32(CompiledModelTestBase.ManyTypes @this) + => GetEnum32(@this); + + public static void WriteEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Array(@this); + + public static void WriteEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsString(@this); + + public static void WriteEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringArray(@this); + + public static void WriteEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringCollection(@this); + + public static void WriteEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Collection(@this); + + public static void WriteEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64(CompiledModelTestBase.ManyTypes @this) + => GetEnum64(@this); + + public static void WriteEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Array(@this); + + public static void WriteEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsString(@this); + + public static void WriteEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringArray(@this); + + public static void WriteEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringCollection(@this); + + public static void WriteEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Collection(@this); + + public static void WriteEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8(CompiledModelTestBase.ManyTypes @this) + => GetEnum8(@this); + + public static void WriteEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Array(@this); + + public static void WriteEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsString(@this); + + public static void WriteEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringArray(@this); + + public static void WriteEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringCollection(@this); + + public static void WriteEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Collection(@this); + + public static void WriteEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToNumberConverterProperty(@this); + + public static void WriteEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToStringConverterProperty(@this); + + public static void WriteEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16(@this); + + public static void WriteEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Array(@this); + + public static void WriteEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsString(@this); + + public static void WriteEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringArray(@this); + + public static void WriteEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringCollection(@this); + + public static void WriteEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Collection(@this); + + public static void WriteEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32(@this); + + public static void WriteEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Array(@this); + + public static void WriteEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsString(@this); + + public static void WriteEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringArray(@this); + + public static void WriteEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringCollection(@this); + + public static void WriteEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Collection(@this); + + public static void WriteEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64(@this); + + public static void WriteEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Array(@this); + + public static void WriteEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsString(@this); + + public static void WriteEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringArray(@this); + + public static void WriteEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringCollection(@this); + + public static void WriteEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Collection(@this); + + public static void WriteEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8(@this); + + public static void WriteEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Array(@this); + + public static void WriteEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsString(@this); + + public static void WriteEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringArray(@this); + + public static void WriteEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringCollection(@this); + + public static void WriteEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Collection(@this); + + public static void WriteEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float GetFloat(CompiledModelTestBase.ManyTypes @this); + + public static float ReadFloat(CompiledModelTestBase.ManyTypes @this) + => GetFloat(@this); + + public static void WriteFloat(CompiledModelTestBase.ManyTypes @this, float value) + => GetFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float[] GetFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float[] ReadFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetFloatArray(@this); + + public static void WriteFloatArray(CompiledModelTestBase.ManyTypes @this, float[] value) + => GetFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuid(CompiledModelTestBase.ManyTypes @this) + => GetGuid(@this); + + public static void WriteGuid(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid[] GetGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid[] ReadGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetGuidArray(@this); + + public static void WriteGuidArray(CompiledModelTestBase.ManyTypes @this, Guid[] value) + => GetGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToBytesConverterProperty(@this); + + public static void WriteGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToStringConverterProperty(@this); + + public static void WriteGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetIPAddress(@this); + + public static void WriteIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressArray(@this); + + public static void WriteIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToBytesConverterProperty(@this); + + public static void WriteIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToStringConverterProperty(@this); + + public static void WriteIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short GetInt16(CompiledModelTestBase.ManyTypes @this); + + public static short ReadInt16(CompiledModelTestBase.ManyTypes @this) + => GetInt16(@this); + + public static void WriteInt16(CompiledModelTestBase.ManyTypes @this, short value) + => GetInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short[] GetInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short[] ReadInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetInt16Array(@this); + + public static void WriteInt16Array(CompiledModelTestBase.ManyTypes @this, short[] value) + => GetInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetInt32(CompiledModelTestBase.ManyTypes @this); + + public static int ReadInt32(CompiledModelTestBase.ManyTypes @this) + => GetInt32(@this); + + public static void WriteInt32(CompiledModelTestBase.ManyTypes @this, int value) + => GetInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int[] GetInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int[] ReadInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetInt32Array(@this); + + public static void WriteInt32Array(CompiledModelTestBase.ManyTypes @this, int[] value) + => GetInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetInt64(CompiledModelTestBase.ManyTypes @this); + + public static long ReadInt64(CompiledModelTestBase.ManyTypes @this) + => GetInt64(@this); + + public static void WriteInt64(CompiledModelTestBase.ManyTypes @this, long value) + => GetInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long[] GetInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long[] ReadInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetInt64Array(@this); + + public static void WriteInt64Array(CompiledModelTestBase.ManyTypes @this, long[] value) + => GetInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte GetInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte ReadInt8(CompiledModelTestBase.ManyTypes @this) + => GetInt8(@this); + + public static void WriteInt8(CompiledModelTestBase.ManyTypes @this, sbyte value) + => GetInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte[] GetInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte[] ReadInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetInt8Array(@this); + + public static void WriteInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte[] value) + => GetInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToBytesConverterProperty(@this); + + public static void WriteIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToStringConverterProperty(@this); + + public static void WriteIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetNullIntToNullStringConverterProperty(@this); + + public static void WriteNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullIntToNullStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool? GetNullableBool(CompiledModelTestBase.ManyTypes @this); + + public static bool? ReadNullableBool(CompiledModelTestBase.ManyTypes @this) + => GetNullableBool(@this); + + public static void WriteNullableBool(CompiledModelTestBase.ManyTypes @this, bool? value) + => GetNullableBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool?[] GetNullableBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool?[] ReadNullableBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBoolArray(@this); + + public static void WriteNullableBoolArray(CompiledModelTestBase.ManyTypes @this, bool?[] value) + => GetNullableBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetNullableBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadNullableBytes(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytes(@this); + + public static void WriteNullableBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetNullableBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetNullableBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadNullableBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytesArray(@this); + + public static void WriteNullableBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetNullableBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char? GetNullableChar(CompiledModelTestBase.ManyTypes @this); + + public static char? ReadNullableChar(CompiledModelTestBase.ManyTypes @this) + => GetNullableChar(@this); + + public static void WriteNullableChar(CompiledModelTestBase.ManyTypes @this, char? value) + => GetNullableChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char?[] GetNullableCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char?[] ReadNullableCharArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableCharArray(@this); + + public static void WriteNullableCharArray(CompiledModelTestBase.ManyTypes @this, char?[] value) + => GetNullableCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly? GetNullableDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly? ReadNullableDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnly(@this); + + public static void WriteNullableDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly? value) + => GetNullableDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly?[] GetNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly?[] ReadNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnlyArray(@this); + + public static void WriteNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly?[] value) + => GetNullableDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime? GetNullableDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime? ReadNullableDateTime(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTime(@this); + + public static void WriteNullableDateTime(CompiledModelTestBase.ManyTypes @this, DateTime? value) + => GetNullableDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime?[] GetNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime?[] ReadNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTimeArray(@this); + + public static void WriteNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime?[] value) + => GetNullableDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal? GetNullableDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal? ReadNullableDecimal(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimal(@this); + + public static void WriteNullableDecimal(CompiledModelTestBase.ManyTypes @this, decimal? value) + => GetNullableDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal?[] GetNullableDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal?[] ReadNullableDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimalArray(@this); + + public static void WriteNullableDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal?[] value) + => GetNullableDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double? GetNullableDouble(CompiledModelTestBase.ManyTypes @this); + + public static double? ReadNullableDouble(CompiledModelTestBase.ManyTypes @this) + => GetNullableDouble(@this); + + public static void WriteNullableDouble(CompiledModelTestBase.ManyTypes @this, double? value) + => GetNullableDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double?[] GetNullableDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double?[] ReadNullableDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDoubleArray(@this); + + public static void WriteNullableDoubleArray(CompiledModelTestBase.ManyTypes @this, double?[] value) + => GetNullableDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16(@this); + + public static void WriteNullableEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Array(@this); + + public static void WriteNullableEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsString(@this); + + public static void WriteNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringArray(@this); + + public static void WriteNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringCollection(@this); + + public static void WriteNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Collection(@this); + + public static void WriteNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32(@this); + + public static void WriteNullableEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Array(@this); + + public static void WriteNullableEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsString(@this); + + public static void WriteNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringArray(@this); + + public static void WriteNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringCollection(@this); + + public static void WriteNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Collection(@this); + + public static void WriteNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64(@this); + + public static void WriteNullableEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Array(@this); + + public static void WriteNullableEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsString(@this); + + public static void WriteNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringArray(@this); + + public static void WriteNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringCollection(@this); + + public static void WriteNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Collection(@this); + + public static void WriteNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8(@this); + + public static void WriteNullableEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Array(@this); + + public static void WriteNullableEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsString(@this); + + public static void WriteNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringArray(@this); + + public static void WriteNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringCollection(@this); + + public static void WriteNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Collection(@this); + + public static void WriteNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16(@this); + + public static void WriteNullableEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Array(@this); + + public static void WriteNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsString(@this); + + public static void WriteNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringArray(@this); + + public static void WriteNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringCollection(@this); + + public static void WriteNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Collection(@this); + + public static void WriteNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32(@this); + + public static void WriteNullableEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Array(@this); + + public static void WriteNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsString(@this); + + public static void WriteNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringArray(@this); + + public static void WriteNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringCollection(@this); + + public static void WriteNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Collection(@this); + + public static void WriteNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64(@this); + + public static void WriteNullableEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Array(@this); + + public static void WriteNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsString(@this); + + public static void WriteNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringArray(@this); + + public static void WriteNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringCollection(@this); + + public static void WriteNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Collection(@this); + + public static void WriteNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8(@this); + + public static void WriteNullableEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Array(@this); + + public static void WriteNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsString(@this); + + public static void WriteNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringArray(@this); + + public static void WriteNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringCollection(@this); + + public static void WriteNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Collection(@this); + + public static void WriteNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float? GetNullableFloat(CompiledModelTestBase.ManyTypes @this); + + public static float? ReadNullableFloat(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloat(@this); + + public static void WriteNullableFloat(CompiledModelTestBase.ManyTypes @this, float? value) + => GetNullableFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float?[] GetNullableFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float?[] ReadNullableFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloatArray(@this); + + public static void WriteNullableFloatArray(CompiledModelTestBase.ManyTypes @this, float?[] value) + => GetNullableFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid? GetNullableGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid? ReadNullableGuid(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuid(@this); + + public static void WriteNullableGuid(CompiledModelTestBase.ManyTypes @this, Guid? value) + => GetNullableGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid?[] GetNullableGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid?[] ReadNullableGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuidArray(@this); + + public static void WriteNullableGuidArray(CompiledModelTestBase.ManyTypes @this, Guid?[] value) + => GetNullableGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetNullableIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadNullableIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddress(@this); + + public static void WriteNullableIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetNullableIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddressArray(@this); + + public static void WriteNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetNullableIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short? GetNullableInt16(CompiledModelTestBase.ManyTypes @this); + + public static short? ReadNullableInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16(@this); + + public static void WriteNullableInt16(CompiledModelTestBase.ManyTypes @this, short? value) + => GetNullableInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short?[] GetNullableInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short?[] ReadNullableInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16Array(@this); + + public static void WriteNullableInt16Array(CompiledModelTestBase.ManyTypes @this, short?[] value) + => GetNullableInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullableInt32(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullableInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32(@this); + + public static void WriteNullableInt32(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullableInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int?[] GetNullableInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int?[] ReadNullableInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32Array(@this); + + public static void WriteNullableInt32Array(CompiledModelTestBase.ManyTypes @this, int?[] value) + => GetNullableInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetNullableInt64(CompiledModelTestBase.ManyTypes @this); + + public static long? ReadNullableInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64(@this); + + public static void WriteNullableInt64(CompiledModelTestBase.ManyTypes @this, long? value) + => GetNullableInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long?[] GetNullableInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long?[] ReadNullableInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64Array(@this); + + public static void WriteNullableInt64Array(CompiledModelTestBase.ManyTypes @this, long?[] value) + => GetNullableInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte? GetNullableInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte? ReadNullableInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8(@this); + + public static void WriteNullableInt8(CompiledModelTestBase.ManyTypes @this, sbyte? value) + => GetNullableInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte?[] GetNullableInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte?[] ReadNullableInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8Array(@this); + + public static void WriteNullableInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte?[] value) + => GetNullableInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddress(@this); + + public static void WriteNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetNullablePhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddressArray(@this); + + public static void WriteNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetNullablePhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNullableString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadNullableString(CompiledModelTestBase.ManyTypes @this) + => GetNullableString(@this); + + public static void WriteNullableString(CompiledModelTestBase.ManyTypes @this, string value) + => GetNullableString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetNullableStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadNullableStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableStringArray(@this); + + public static void WriteNullableStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetNullableStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly? GetNullableTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly? ReadNullableTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnly(@this); + + public static void WriteNullableTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly? value) + => GetNullableTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly?[] GetNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly?[] ReadNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnlyArray(@this); + + public static void WriteNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly?[] value) + => GetNullableTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan? GetNullableTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan? ReadNullableTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpan(@this); + + public static void WriteNullableTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan? value) + => GetNullableTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan?[] GetNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan?[] ReadNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpanArray(@this); + + public static void WriteNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan?[] value) + => GetNullableTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort? GetNullableUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort? ReadNullableUInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16(@this); + + public static void WriteNullableUInt16(CompiledModelTestBase.ManyTypes @this, ushort? value) + => GetNullableUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort?[] GetNullableUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort?[] ReadNullableUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16Array(@this); + + public static void WriteNullableUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort?[] value) + => GetNullableUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint? GetNullableUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint? ReadNullableUInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32(@this); + + public static void WriteNullableUInt32(CompiledModelTestBase.ManyTypes @this, uint? value) + => GetNullableUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint?[] GetNullableUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint?[] ReadNullableUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32Array(@this); + + public static void WriteNullableUInt32Array(CompiledModelTestBase.ManyTypes @this, uint?[] value) + => GetNullableUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong? GetNullableUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong? ReadNullableUInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64(@this); + + public static void WriteNullableUInt64(CompiledModelTestBase.ManyTypes @this, ulong? value) + => GetNullableUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong?[] GetNullableUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong?[] ReadNullableUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64Array(@this); + + public static void WriteNullableUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong?[] value) + => GetNullableUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetNullableUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte? ReadNullableUInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8(@this); + + public static void WriteNullableUInt8(CompiledModelTestBase.ManyTypes @this, byte? value) + => GetNullableUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte?[] GetNullableUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte?[] ReadNullableUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8Array(@this); + + public static void WriteNullableUInt8Array(CompiledModelTestBase.ManyTypes @this, byte?[] value) + => GetNullableUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetNullableUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadNullableUri(CompiledModelTestBase.ManyTypes @this) + => GetNullableUri(@this); + + public static void WriteNullableUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetNullableUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetNullableUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadNullableUriArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableUriArray(@this); + + public static void WriteNullableUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetNullableUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddress(@this); + + public static void WritePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressArray(@this); + + public static void WritePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetPhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToBytesConverterProperty(@this); + + public static void WritePhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToStringConverterProperty(@this); + + public static void WritePhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadString(CompiledModelTestBase.ManyTypes @this) + => GetString(@this); + + public static void WriteString(CompiledModelTestBase.ManyTypes @this, string value) + => GetString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadStringArray(CompiledModelTestBase.ManyTypes @this) + => GetStringArray(@this); + + public static void WriteStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBoolConverterProperty(@this); + + public static void WriteStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBoolConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBytesConverterProperty(@this); + + public static void WriteStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToCharConverterProperty(@this); + + public static void WriteStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToCharConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateOnlyConverterProperty(@this); + + public static void WriteStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeConverterProperty(@this); + + public static void WriteStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeOffsetConverterProperty(@this); + + public static void WriteStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeOffsetConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDecimalNumberConverterProperty(@this); + + public static void WriteStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDecimalNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDoubleNumberConverterProperty(@this); + + public static void WriteStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDoubleNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToEnumConverterProperty(@this); + + public static void WriteStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToEnumConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToGuidConverterProperty(@this); + + public static void WriteStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToGuidConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToIntNumberConverterProperty(@this); + + public static void WriteStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToIntNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeOnlyConverterProperty(@this); + + public static void WriteStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeSpanConverterProperty(@this); + + public static void WriteStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeSpanConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToUriConverterProperty(@this); + + public static void WriteStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToUriConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnly(@this); + + public static void WriteTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly[] GetTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly[] ReadTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyArray(@this); + + public static void WriteTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly[] value) + => GetTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToStringConverterProperty(@this); + + public static void WriteTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToTicksConverterProperty(@this); + + public static void WriteTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpan(@this); + + public static void WriteTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan[] GetTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan[] ReadTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanArray(@this); + + public static void WriteTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan[] value) + => GetTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToStringConverterProperty(@this); + + public static void WriteTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToTicksConverterProperty(@this); + + public static void WriteTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort GetUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort ReadUInt16(CompiledModelTestBase.ManyTypes @this) + => GetUInt16(@this); + + public static void WriteUInt16(CompiledModelTestBase.ManyTypes @this, ushort value) + => GetUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort[] GetUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort[] ReadUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt16Array(@this); + + public static void WriteUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort[] value) + => GetUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint GetUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint ReadUInt32(CompiledModelTestBase.ManyTypes @this) + => GetUInt32(@this); + + public static void WriteUInt32(CompiledModelTestBase.ManyTypes @this, uint value) + => GetUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint[] GetUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint[] ReadUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt32Array(@this); + + public static void WriteUInt32Array(CompiledModelTestBase.ManyTypes @this, uint[] value) + => GetUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong GetUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong ReadUInt64(CompiledModelTestBase.ManyTypes @this) + => GetUInt64(@this); + + public static void WriteUInt64(CompiledModelTestBase.ManyTypes @this, ulong value) + => GetUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong[] GetUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong[] ReadUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt64Array(@this); + + public static void WriteUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong[] value) + => GetUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte GetUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte ReadUInt8(CompiledModelTestBase.ManyTypes @this) + => GetUInt8(@this); + + public static void WriteUInt8(CompiledModelTestBase.ManyTypes @this, byte value) + => GetUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt8Array(@this); + + public static void WriteUInt8Array(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUri(CompiledModelTestBase.ManyTypes @this) + => GetUri(@this); + + public static void WriteUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadUriArray(CompiledModelTestBase.ManyTypes @this) + => GetUriArray(@this); + + public static void WriteUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetUriToStringConverterProperty(@this); + + public static void WriteUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUriToStringConverterProperty(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs index 69bb41b404f..d56818d9c40 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +39,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalDerivedId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalDerivedId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -49,6 +58,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); principalDerivedId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalDerivedAlternateId = runtimeEntityType.AddProperty( @@ -56,6 +66,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalDerivedAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalDerivedAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -71,6 +87,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalDerivedAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedAlternateId)); principalDerivedAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var id = runtimeEntityType.AddProperty( @@ -79,6 +96,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: 2, + storeGenerationIndex: 2); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -92,6 +115,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var details = runtimeEntityType.AddProperty( @@ -100,6 +124,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[3]); + details.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -126,6 +171,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[4]); + number.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -147,6 +213,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeArray.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -211,6 +298,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeEnumerable.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -259,6 +367,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeIList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -307,6 +436,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeList.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -371,6 +521,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeArray.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -414,6 +585,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeEnumerable.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -457,6 +649,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeIList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -500,6 +713,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeList.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -565,11 +799,79 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("ManyOwned", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), eagerLoaded: true); + manyOwned.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance) == null); + manyOwned.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(manyOwned), + null); + manyOwned.SetPropertyIndexes( + index: 3, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + manyOwned.SetCollectionAccessor>, ICollection, CompiledModelTestBase.OwnedType>( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.OwnedType>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var principalDerivedAlternateId = runtimeEntityType.FindProperty("PrincipalDerivedAlternateId")!; + var id = runtimeEntityType.FindProperty("Id")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalDerivedId") ? (long)source["PrincipalDerivedId"] : 0L, source.ContainsKey("PrincipalDerivedAlternateId") ? (Guid)source["PrincipalDerivedAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 13, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 13, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:ContainerColumnName", "ManyOwned"); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -582,5 +884,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs index 875d0177525..678217daf74 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -38,6 +41,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalBaseId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalBaseId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -51,6 +60,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); principalBaseId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalBaseAlternateId = runtimeEntityType.AddProperty( @@ -59,6 +69,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalBaseAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -74,6 +90,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalBaseAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseAlternateId)); principalBaseAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var details = runtimeEntityType.AddProperty( @@ -83,6 +100,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[2]); + details.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -110,6 +148,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[3]); + number.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -132,6 +191,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[4]); + refTypeArray.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -197,6 +277,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeEnumerable.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -246,6 +347,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeIList.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -295,6 +417,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -360,6 +503,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[8]); + valueTypeArray.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -404,6 +568,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeEnumerable.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -448,6 +633,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeIList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -492,6 +698,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -561,11 +788,72 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyAccessMode: PropertyAccessMode.Field, eagerLoaded: true); + owned.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance) == null); + owned.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(owned), + null); + owned.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalBaseAlternateId = runtimeEntityType.FindProperty("PrincipalBaseAlternateId")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalBaseId") ? (long)source["PrincipalBaseId"] : 0L, source.ContainsKey("PrincipalBaseAlternateId") ? (Guid)source["PrincipalBaseAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"))); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 12, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 12, + shadowCount: 2, + relationshipCount: 2, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:ContainerColumnName", "Owned"); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -578,5 +866,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs index 1730d8cf461..d311943404d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -41,6 +44,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -54,6 +78,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var alternateId = runtimeEntityType.AddProperty( @@ -64,6 +89,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000"), jsonValueReaderWriter: new CompiledModelTestBase.MyJsonGuidReaderWriter()); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetAccessors( + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(alternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + alternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: -1); alternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -79,6 +125,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + alternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(alternateId)); alternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var discriminator = runtimeEntityType.AddProperty( @@ -87,6 +134,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 55, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -112,6 +165,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum1.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -142,6 +216,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[4]); + enum2.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -170,6 +265,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum1.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -199,6 +315,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C)), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C))); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[6]); + flagsEnum2.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -229,6 +366,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -293,6 +451,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -341,6 +520,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -389,6 +589,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -453,6 +674,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -496,6 +738,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -539,6 +802,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -582,6 +866,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -655,11 +960,82 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ReadOwned(entity), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 1, + relationshipCount: 4, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -672,5 +1048,140 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs index 5bc231d18c8..9d83771ded9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs @@ -6,7 +6,9 @@ using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +38,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null ? 0L : (long)(entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null ? 0L : (long)(instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null); + derivedsId.SetSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsId, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsId, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + derivedsId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); derivedsId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -49,6 +96,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + derivedsId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsId)); derivedsId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var derivedsAlternateId = runtimeEntityType.AddProperty( @@ -56,6 +104,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null); + derivedsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(1)) + { + return entry.ReadStoreGeneratedValue(1); + } + else + { + { + if (entry.FlaggedAsTemporary(1) && (((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(1); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsAlternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsAlternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + derivedsAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); derivedsAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -71,6 +164,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + derivedsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsAlternateId)); derivedsAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalsId = runtimeEntityType.AddProperty( @@ -78,6 +172,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null ? 0L : (long)(entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null ? 0L : (long)(instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null); + principalsId.SetSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(2)) + { + return entry.ReadStoreGeneratedValue(2); + } + else + { + { + if (entry.FlaggedAsTemporary(2) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null) == null) + { + return entry.ReadTemporaryValue(2); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsId, 2), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsId, 2), + (ValueBuffer valueBuffer) => valueBuffer[2]); + principalsId.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: 2); principalsId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -91,6 +230,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v1, long v2) => v1 == v2, (long v) => v.GetHashCode(), (long v) => v)); + principalsId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsId)); principalsId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalsAlternateId = runtimeEntityType.AddProperty( @@ -98,6 +238,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null); + principalsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(3)) + { + return entry.ReadStoreGeneratedValue(3); + } + else + { + { + if (entry.FlaggedAsTemporary(3) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(3); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsAlternateId, 3), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsAlternateId, 3), + (ValueBuffer valueBuffer) => valueBuffer[3]); + principalsAlternateId.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: 3); principalsAlternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -113,6 +298,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "uniqueidentifier")); + principalsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsAlternateId)); principalsAlternateId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var rowid = runtimeEntityType.AddProperty( @@ -124,19 +310,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + rowid.SetGetter( + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null ? null : (byte[])(entity.ContainsKey("rowid") ? entity["rowid"] : null), + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null ? null : (byte[])(instance.ContainsKey("rowid") ? instance["rowid"] : null), + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null); + rowid.SetSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetMaterializationSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(4) ? entry.ReadStoreGeneratedValue(4) : entry.FlaggedAsTemporary(4) && (((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null) == null ? entry.ReadTemporaryValue(4) : (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => entry.ReadOriginalValue(rowid, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(rowid), + (ValueBuffer valueBuffer) => valueBuffer[4]); + rowid.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 4); rowid.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(v1, v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals(v1, v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "rowversion", size: 8), @@ -177,12 +384,46 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var derivedsId = runtimeEntityType.FindProperty("DerivedsId")!; + var derivedsAlternateId = runtimeEntityType.FindProperty("DerivedsAlternateId")!; + var principalsId = runtimeEntityType.FindProperty("PrincipalsId")!; + var principalsAlternateId = runtimeEntityType.FindProperty("PrincipalsAlternateId")!; + var rowid = runtimeEntityType.FindProperty("rowid")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId)), source.GetCurrentValue(rowid) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(source.GetCurrentValue(rowid))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(default(Guid)), default(byte[]) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(default(byte[])))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(long), default(Guid), default(byte[]))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 5, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 5, + shadowCount: 0, + relationshipCount: 4, + storeGeneratedCount: 5); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); runtimeEntityType.AddAnnotation("Relational:TableName", "PrincipalBasePrincipalDerived>"); runtimeEntityType.AddAnnotation("Relational:ViewName", null); runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + runtimeEntityType.AddAnnotation("SqlServer:MemoryOptimized", true); Customize(runtimeEntityType); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs index 4c3093adac0..8735fc70d54 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs @@ -1,8 +1,13 @@ // using System; using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -40,9 +45,7 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl false, typeof(ICollection), propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: true, - lazyLoadingEnabled: false); + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var inverse = targetEntityType.FindSkipNavigation("Deriveds"); if (inverse != null) @@ -51,11 +54,84 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 4, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 6, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + var manyOwned = runtimeEntityType.FindNavigation("ManyOwned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object, object, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), PrincipalBaseEntityType.ReadOwned(entity), null, ReadDependent(entity), SnapshotFactoryFactory.SnapshotCollection(ReadManyOwned(entity)), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 5, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 1, + relationshipCount: 7, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -67,5 +143,32 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetPrincipals(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadPrincipals(CompiledModelTestBase.PrincipalDerived> @this) + => GetPrincipals(@this); + + public static void WritePrincipals(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetPrincipals(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "ManyOwned")] + extern static ref ICollection GetManyOwned(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadManyOwned(CompiledModelTestBase.PrincipalDerived> @this) + => GetManyOwned(@this); + + public static void WriteManyOwned(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetManyOwned(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs index 15190be66ae..dd064cb4aed 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -44,6 +54,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var blob = runtimeEntityType.AddProperty( @@ -52,19 +63,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -79,6 +111,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -90,5 +152,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs index fe7e97ba3d2..c74380ad28b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalBaseEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -43,6 +46,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -56,6 +80,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var discriminator = runtimeEntityType.AddProperty( @@ -64,6 +89,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 55, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -89,6 +120,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum1.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -119,6 +171,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum2.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -147,6 +220,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum1.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -176,6 +270,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum2.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -204,6 +319,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "PrincipalBaseId", typeof(long?), nullable: true); + principalBaseId.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -217,6 +338,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); principalBaseId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var refTypeArray = runtimeEntityType.AddProperty( @@ -225,6 +347,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -289,6 +432,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -337,6 +501,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -385,6 +570,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -449,6 +655,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -492,6 +719,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -535,6 +783,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -578,6 +847,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -626,7 +916,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas return runtimeEntityType; } - private static class OwnedComplexProperty + public static class OwnedComplexProperty { public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) { @@ -642,6 +932,27 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) complexPropertyCount: 1); var complexType = complexProperty.ComplexType; + complexProperty.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadOwned(instance) == null); + complexProperty.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => WriteOwned(entity, value)); + complexProperty.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => WriteOwned(entity, value)); + complexProperty.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(complexProperty), + null); + complexProperty.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); var details = complexType.AddProperty( "Details", typeof(string), @@ -658,6 +969,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) precision: 3, scale: 2, sentinel: ""); + details.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details, + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details) == null) && (ReadOwned(entity) == null ? default(string) : ReadOwned(entity).Details) == "", + (CompiledModelTestBase.OwnedType instance) => instance.Details, + (CompiledModelTestBase.OwnedType instance) => !(instance.Details == null) && instance.Details == ""); + details.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, string value) => + { + var level1 = ReadOwned(entity); + level1.Details = value; + }); + details.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, string value) => + { + var level1 = ReadOwned(entity); + level1.Details = value; + }); + details.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(15) ? entry.ReadStoreGeneratedValue(2) : entry.FlaggedAsTemporary(15) && !((ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details) == null) && (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details) == "" ? entry.ReadTemporaryValue(2) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details, + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(string) : ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity).Details, + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[15]); + details.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 2); details.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -687,6 +1027,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(int) : ReadNumber(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(int) : ReadNumber(ReadOwned(entity))) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, int value) => + { + var level1 = ReadOwned(entity); + WriteNumber(level1, value); + }); + number.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, int value) => + { + var level1 = ReadOwned(entity); + WriteNumber(level1, value); + }); + number.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(int) : ReadNumber(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(int) : ReadNumber(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[16]); + number.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -708,6 +1077,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeArray(level1, value); + }); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeArray(level1, value); + }); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + refTypeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -772,6 +1170,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeEnumerable(level1, value); + }); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeEnumerable(level1, value); + }); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[18]); + refTypeEnumerable.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -820,6 +1247,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeIList(level1, value); + }); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeIList(level1, value); + }); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[19]); + refTypeIList.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -868,6 +1324,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(List) : ReadRefTypeList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(List) : ReadRefTypeList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeList(level1, value); + }); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteRefTypeList(level1, value); + }); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[20]); + refTypeList.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -932,6 +1417,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeArray(level1, value); + }); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeArray(level1, value); + }); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[21]); + valueTypeArray.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -975,6 +1489,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeEnumerable(level1, value); + }); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeEnumerable(level1, value); + }); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[22]); + valueTypeEnumerable.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1018,6 +1561,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeIList(level1, value); + }); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeIList(level1, value); + }); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[23]); + valueTypeIList.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1061,6 +1633,35 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(List) : ReadValueTypeList(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(List) : ReadValueTypeList(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeList(level1, value); + }); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + WriteValueTypeList(level1, value); + }); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[24]); + valueTypeList.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -1110,7 +1711,7 @@ public static RuntimeComplexProperty Create(RuntimeEntityType declaringType) return complexProperty; } - private static class PrincipalComplexProperty + public static class PrincipalComplexProperty { public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) { @@ -1123,11 +1724,71 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyCount: 14); var complexType = complexProperty.ComplexType; + complexProperty.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)), + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null, + (CompiledModelTestBase.OwnedType instance) => ReadPrincipal(instance), + (CompiledModelTestBase.OwnedType instance) => ReadPrincipal(instance) == null); + complexProperty.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.PrincipalBase value) => + { + var level1 = ReadOwned(entity); + WritePrincipal(level1, value); + }); + complexProperty.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.PrincipalBase value) => + { + var level1 = ReadOwned(entity); + WritePrincipal(level1, value); + }); + complexProperty.SetAccessors( + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + (InternalEntityEntry entry) => ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity)), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(complexProperty), + null); + complexProperty.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); var alternateId = complexType.AddProperty( "AlternateId", typeof(Guid), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("AlternateId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Guid) : (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))).AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Guid) : (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))).AlternateId) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + level2.AlternateId = value; + }); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + level2.AlternateId = value; + }); + alternateId.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Guid) : (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))).AlternateId, + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Guid) : (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(alternateId), + (ValueBuffer valueBuffer) => valueBuffer[25]); + alternateId.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); alternateId.TypeMapping = GuidTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -1150,6 +1811,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum1(level2, value); + }); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum1(level2, value); + }); + enum1.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AnEnum) : ReadEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[26]); + enum1.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -1180,6 +1872,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum2(level2, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value); + }); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteEnum2(level2, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value); + }); + enum2.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[27]); + enum2.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -1208,6 +1931,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum1(level2, value); + }); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum1(level2, value); + }); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum1(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[28]); + flagsEnum1.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -1237,6 +1991,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum2(level2, value); + }); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteFlagsEnum2(level2, value); + }); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(CompiledModelTestBase.AFlagsEnum) : ReadFlagsEnum2(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[29]); + flagsEnum2.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -1267,6 +2052,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadId(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => !((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(Nullable) : ReadId(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteId(level2, value); + }); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteId(level2, value); + }); + id.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadId(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(Nullable) : ReadId(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[30]); + id.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -1288,6 +2104,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeArray(level2, value); + }); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeArray(level2, value); + }); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IPAddress[]) : ReadRefTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[31]); + refTypeArray.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -1352,6 +2199,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeEnumerable(level2, value); + }); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeEnumerable(level2, value); + }); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadRefTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[32]); + refTypeEnumerable.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -1400,6 +2278,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeIList(level2, value); + }); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeIList(level2, value); + }); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadRefTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[33]); + refTypeIList.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -1448,6 +2357,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadRefTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadRefTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeList(level2, value); + }); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteRefTypeList(level2, value); + }); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadRefTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[34]); + refTypeList.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -1512,6 +2452,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeArray(level2, value); + }); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeArray(level2, value); + }); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(DateTime[]) : ReadValueTypeArray(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + valueTypeArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -1555,6 +2526,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeEnumerable(level2, value); + }); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeEnumerable(level2, value); + }); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IEnumerable) : ReadValueTypeEnumerable(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[36]); + valueTypeEnumerable.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1598,6 +2600,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeIList(level2, value); + }); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeIList(level2, value); + }); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(IList) : ReadValueTypeIList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[37]); + valueTypeIList.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -1641,6 +2674,37 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => (ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadValueTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))), + (CompiledModelTestBase.PrincipalBase entity) => ((ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity))) == null ? default(List) : ReadValueTypeList(ReadOwned(entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned(entity)))) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeList(level2, value); + }); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => + { + var level1 = ReadOwned(entity); + var level2 = ReadPrincipal(level1); + WriteValueTypeList(level2, value); + }); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => (ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))) == null ? default(List) : ReadValueTypeList(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity) == null ? default(CompiledModelTestBase.PrincipalBase) : ReadPrincipal(ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity))), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[38]); + valueTypeList.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -1686,7 +2750,232 @@ public static RuntimeComplexProperty Create(RuntimeComplexType declaringType) complexType.AddAnnotation("Relational:ViewSchema", null); return complexProperty; } + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalBase GetPrincipal(CompiledModelTestBase.OwnedType @this); + + public static CompiledModelTestBase.PrincipalBase ReadPrincipal(CompiledModelTestBase.OwnedType @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.OwnedType @this, CompiledModelTestBase.PrincipalBase value) + => GetPrincipal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; } + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) @@ -1702,46 +2991,147 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + deriveds.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance) == null); + deriveds.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(deriveds), + null); + deriveds.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); + deriveds.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindComplexProperty("Owned")!; + var ownedType = owned.ComplexType; + var details = ownedType.FindProperty("Details")!; + var number = ownedType.FindProperty("Number")!; + var refTypeArray0 = ownedType.FindProperty("RefTypeArray")!; + var refTypeEnumerable0 = ownedType.FindProperty("RefTypeEnumerable")!; + var refTypeIList0 = ownedType.FindProperty("RefTypeIList")!; + var refTypeList0 = ownedType.FindProperty("RefTypeList")!; + var valueTypeArray0 = ownedType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable0 = ownedType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList0 = ownedType.FindProperty("ValueTypeIList")!; + var valueTypeList0 = ownedType.FindProperty("ValueTypeList")!; + var principal = ownedType.FindComplexProperty("Principal")!; + var principalBase = principal.ComplexType; + var alternateId = principalBase.FindProperty("AlternateId")!; + var enum10 = principalBase.FindProperty("Enum1")!; + var enum20 = principalBase.FindProperty("Enum2")!; + var flagsEnum10 = principalBase.FindProperty("FlagsEnum1")!; + var flagsEnum20 = principalBase.FindProperty("FlagsEnum2")!; + var id0 = principalBase.FindProperty("Id")!; + var refTypeArray1 = principalBase.FindProperty("RefTypeArray")!; + var refTypeEnumerable1 = principalBase.FindProperty("RefTypeEnumerable")!; + var refTypeIList1 = principalBase.FindProperty("RefTypeIList")!; + var refTypeList1 = principalBase.FindProperty("RefTypeList")!; + var valueTypeArray1 = principalBase.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable1 = principalBase.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList1 = principalBase.FindProperty("ValueTypeIList")!; + var valueTypeList1 = principalBase.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + var liftedArg = (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, string, int, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray0) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray0)), source.GetCurrentValue>(refTypeEnumerable0) == null ? null : ((ValueComparer>)refTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(refTypeIList0) == null ? null : (IList)((ValueComparer>)refTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList0)), (IEnumerable)source.GetCurrentValue>(refTypeList0) == null ? null : (List)((ValueComparer>)refTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList0)), (IEnumerable)source.GetCurrentValue(valueTypeArray0) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray0)), source.GetCurrentValue>(valueTypeEnumerable0) == null ? null : ((ValueComparer>)valueTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(valueTypeIList0) == null ? null : (IList)((ValueComparer>)valueTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList0)), (IEnumerable)source.GetCurrentValue>(valueTypeList0) == null ? null : (List)((ValueComparer>)valueTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList0)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum10.GetValueComparer()).Snapshot(source.GetCurrentValue(enum10)), source.GetCurrentValue>(enum20) == null ? null : ((ValueComparer>)enum20.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum20)), ((ValueComparer)flagsEnum10.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum10)), ((ValueComparer)flagsEnum20.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum20))); + var entity0 = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, (ISnapshot)new Snapshot, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id0) == null ? null : ((ValueComparer>)id0.GetValueComparer()).Snapshot(source.GetCurrentValue>(id0)), (IEnumerable)source.GetCurrentValue(refTypeArray1) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray1)), source.GetCurrentValue>(refTypeEnumerable1) == null ? null : ((ValueComparer>)refTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(refTypeIList1) == null ? null : (IList)((ValueComparer>)refTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList1)), (IEnumerable)source.GetCurrentValue>(refTypeList1) == null ? null : (List)((ValueComparer>)refTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList1)), (IEnumerable)source.GetCurrentValue(valueTypeArray1) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray1)), source.GetCurrentValue>(valueTypeEnumerable1) == null ? null : ((ValueComparer>)valueTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(valueTypeIList1) == null ? null : (IList)((ValueComparer>)valueTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList1)), (IEnumerable)source.GetCurrentValue>(valueTypeList1) == null ? null : (List)((ValueComparer>)valueTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList1))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(string) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(default(string)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable), default(Nullable), default(string))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(string), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), SnapshotFactoryFactory.SnapshotCollection(ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 39, + navigationCount: 1, + complexPropertyCount: 2, + originalValueCount: 39, + shadowCount: 2, + relationshipCount: 3, + storeGeneratedCount: 3); var insertSproc = new RuntimeStoredProcedure( runtimeEntityType, "PrincipalBase_Insert", null, false); - var principalBaseId = insertSproc.AddParameter( + var principalBaseId0 = insertSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var enum1 = insertSproc.AddParameter( + var enum11 = insertSproc.AddParameter( "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); - var enum2 = insertSproc.AddParameter( + var enum21 = insertSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum1 = insertSproc.AddParameter( + var flagsEnum11 = insertSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum2 = insertSproc.AddParameter( + var flagsEnum21 = insertSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList = insertSproc.AddParameter( + var valueTypeList2 = insertSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList = insertSproc.AddParameter( + var valueTypeIList2 = insertSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray = insertSproc.AddParameter( + var valueTypeArray2 = insertSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable = insertSproc.AddParameter( + var valueTypeEnumerable2 = insertSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList = insertSproc.AddParameter( + var refTypeList2 = insertSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList = insertSproc.AddParameter( + var refTypeIList2 = insertSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray = insertSproc.AddParameter( + var refTypeArray2 = insertSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable = insertSproc.AddParameter( + var refTypeEnumerable2 = insertSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); - var discriminator = insertSproc.AddParameter( + var discriminator0 = insertSproc.AddParameter( "Discriminator", System.Data.ParameterDirection.Input, false, "Discriminator", false); - var id = insertSproc.AddParameter( + var id1 = insertSproc.AddParameter( "Id", System.Data.ParameterDirection.Output, false, "Id", false); runtimeEntityType.AddAnnotation("Relational:InsertStoredProcedure", insertSproc); @@ -1751,7 +3141,7 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) null, true); - var id0 = deleteSproc.AddParameter( + var id2 = deleteSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:DeleteStoredProcedure", deleteSproc); @@ -1761,33 +3151,33 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) null, false); - var principalBaseId0 = updateSproc.AddParameter( + var principalBaseId1 = updateSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var enum10 = updateSproc.AddParameter( + var enum12 = updateSproc.AddParameter( "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); - var enum20 = updateSproc.AddParameter( + var enum22 = updateSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum10 = updateSproc.AddParameter( + var flagsEnum12 = updateSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum20 = updateSproc.AddParameter( + var flagsEnum22 = updateSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList0 = updateSproc.AddParameter( + var valueTypeList3 = updateSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList0 = updateSproc.AddParameter( + var valueTypeIList3 = updateSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray0 = updateSproc.AddParameter( + var valueTypeArray3 = updateSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable0 = updateSproc.AddParameter( + var valueTypeEnumerable3 = updateSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList0 = updateSproc.AddParameter( + var refTypeList3 = updateSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList0 = updateSproc.AddParameter( + var refTypeIList3 = updateSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray0 = updateSproc.AddParameter( + var refTypeArray3 = updateSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable0 = updateSproc.AddParameter( + var refTypeEnumerable3 = updateSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); - var id1 = updateSproc.AddParameter( + var id3 = updateSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:UpdateStoredProcedure", updateSproc); @@ -1804,5 +3194,131 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs index f21ea3b1578..a57c0acbbfa 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/PrincipalDerivedEntityType.cs @@ -1,7 +1,12 @@ // using System; +using System.Collections.Generic; +using System.Net; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -26,6 +31,80 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindComplexProperty("Owned")!; + var ownedType = owned.ComplexType; + var details = ownedType.FindProperty("Details")!; + var number = ownedType.FindProperty("Number")!; + var refTypeArray0 = ownedType.FindProperty("RefTypeArray")!; + var refTypeEnumerable0 = ownedType.FindProperty("RefTypeEnumerable")!; + var refTypeIList0 = ownedType.FindProperty("RefTypeIList")!; + var refTypeList0 = ownedType.FindProperty("RefTypeList")!; + var valueTypeArray0 = ownedType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable0 = ownedType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList0 = ownedType.FindProperty("ValueTypeIList")!; + var valueTypeList0 = ownedType.FindProperty("ValueTypeList")!; + var principal = ownedType.FindComplexProperty("Principal")!; + var principalBase = principal.ComplexType; + var alternateId = principalBase.FindProperty("AlternateId")!; + var enum10 = principalBase.FindProperty("Enum1")!; + var enum20 = principalBase.FindProperty("Enum2")!; + var flagsEnum10 = principalBase.FindProperty("FlagsEnum1")!; + var flagsEnum20 = principalBase.FindProperty("FlagsEnum2")!; + var id0 = principalBase.FindProperty("Id")!; + var refTypeArray1 = principalBase.FindProperty("RefTypeArray")!; + var refTypeEnumerable1 = principalBase.FindProperty("RefTypeEnumerable")!; + var refTypeIList1 = principalBase.FindProperty("RefTypeIList")!; + var refTypeList1 = principalBase.FindProperty("RefTypeList")!; + var valueTypeArray1 = principalBase.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable1 = principalBase.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList1 = principalBase.FindProperty("ValueTypeIList")!; + var valueTypeList1 = principalBase.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity1 = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, string, int, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray0) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray0)), source.GetCurrentValue>(refTypeEnumerable0) == null ? null : ((ValueComparer>)refTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(refTypeIList0) == null ? null : (IList)((ValueComparer>)refTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList0)), (IEnumerable)source.GetCurrentValue>(refTypeList0) == null ? null : (List)((ValueComparer>)refTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList0)), (IEnumerable)source.GetCurrentValue(valueTypeArray0) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray0)), source.GetCurrentValue>(valueTypeEnumerable0) == null ? null : ((ValueComparer>)valueTypeEnumerable0.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable0)), (IEnumerable)source.GetCurrentValue>(valueTypeIList0) == null ? null : (IList)((ValueComparer>)valueTypeIList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList0)), (IEnumerable)source.GetCurrentValue>(valueTypeList0) == null ? null : (List)((ValueComparer>)valueTypeList0.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList0)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum10.GetValueComparer()).Snapshot(source.GetCurrentValue(enum10)), source.GetCurrentValue>(enum20) == null ? null : ((ValueComparer>)enum20.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum20)), ((ValueComparer)flagsEnum10.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum10)), ((ValueComparer)flagsEnum20.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum20))); + var entity2 = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg0, (ISnapshot)new Snapshot, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id0) == null ? null : ((ValueComparer>)id0.GetValueComparer()).Snapshot(source.GetCurrentValue>(id0)), (IEnumerable)source.GetCurrentValue(refTypeArray1) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray1)), source.GetCurrentValue>(refTypeEnumerable1) == null ? null : ((ValueComparer>)refTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(refTypeIList1) == null ? null : (IList)((ValueComparer>)refTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList1)), (IEnumerable)source.GetCurrentValue>(refTypeList1) == null ? null : (List)((ValueComparer>)refTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList1)), (IEnumerable)source.GetCurrentValue(valueTypeArray1) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray1)), source.GetCurrentValue>(valueTypeEnumerable1) == null ? null : ((ValueComparer>)valueTypeEnumerable1.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable1)), (IEnumerable)source.GetCurrentValue>(valueTypeIList1) == null ? null : (IList)((ValueComparer>)valueTypeIList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList1)), (IEnumerable)source.GetCurrentValue>(valueTypeList1) == null ? null : (List)((ValueComparer>)valueTypeList1.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList1))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(string) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(default(string)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable, string>(default(Nullable), default(Nullable), default(string))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(string), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), SnapshotFactoryFactory.SnapshotCollection(PrincipalBaseEntityType.ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 39, + navigationCount: 1, + complexPropertyCount: 2, + originalValueCount: 39, + shadowCount: 2, + relationshipCount: 3, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", "select * from PrincipalBase"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs index 2d01f90b427..cb58cf66a54 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -30,19 +34,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 0), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[0]); + blob.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -53,6 +78,31 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()"); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -64,5 +114,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs index ffdea2f1274..dcdc1169e43 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs @@ -1,7 +1,10 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; #pragma warning disable 219, 612, 618 #nullable disable @@ -23,6 +26,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 0, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 0, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", "GetBlobs()"); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs index 15190be66ae..dd064cb4aed 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -44,6 +54,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var blob = runtimeEntityType.AddProperty( @@ -52,19 +63,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -79,6 +111,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -90,5 +152,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_HiLo_sequence/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_HiLo_sequence/DataEntityType.cs index 532012599f7..36483009f30 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_HiLo_sequence/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_HiLo_sequence/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -44,6 +54,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:HiLoSequenceName", "HL"); id.AddAnnotation("SqlServer:HiLoSequenceSchema", "S"); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); @@ -54,19 +65,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -81,6 +113,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -92,5 +154,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_sequence/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_sequence/DataEntityType.cs index aa5d6b7bc75..5f2c3d2d50a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_sequence/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Key_sequence/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -44,6 +54,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("Relational:DefaultValueSql", "NEXT VALUE FOR [KeySeqSchema].[KeySeq]"); id.AddAnnotation("SqlServer:SequenceName", "KeySeq"); id.AddAnnotation("SqlServer:SequenceSchema", "KeySeqSchema"); @@ -55,19 +66,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -82,6 +114,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -93,5 +155,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/SpatialTypesTest/SpatialTypesEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/SpatialTypesTest/SpatialTypesEntityType.cs index fc5c55f1a40..607ee75c144 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/SpatialTypesTest/SpatialTypesEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/SpatialTypesTest/SpatialTypesEntityType.cs @@ -1,8 +1,12 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -32,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetGetter( + (CompiledModelRelationalTestBase.SpatialTypes entity) => ReadId(entity), + (CompiledModelRelationalTestBase.SpatialTypes entity) => ReadId(entity) == 0, + (CompiledModelRelationalTestBase.SpatialTypes instance) => ReadId(instance), + (CompiledModelRelationalTestBase.SpatialTypes instance) => ReadId(instance) == 0); + id.SetSetter( + (CompiledModelRelationalTestBase.SpatialTypes entity, int value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelRelationalTestBase.SpatialTypes entity, int value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelRelationalTestBase.SpatialTypes)entry.Entity) == 0 ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelRelationalTestBase.SpatialTypes)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelRelationalTestBase.SpatialTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -45,6 +70,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var point = runtimeEntityType.AddProperty( @@ -55,6 +81,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueConverter: new CastingConverter(), valueComparer: new CompiledModelTestBase.CustomValueComparer(), providerValueComparer: new CompiledModelTestBase.CustomValueComparer()); + point.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: 1); point.TypeMapping = null; point.AddAnnotation("Relational:ColumnType", "geometry"); point.AddAnnotation("Relational:DefaultValue", (NetTopologySuite.Geometries.Point)new NetTopologySuite.IO.WKTReader().Read("SRID=0;POINT Z(0 0 0)")); @@ -69,6 +101,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var point = runtimeEntityType.FindProperty("Point")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelRelationalTestBase.SpatialTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)), default(Point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(default(Point)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int), default(Point))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelRelationalTestBase.SpatialTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -80,5 +142,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetId(CompiledModelRelationalTestBase.SpatialTypes @this); + + public static int ReadId(CompiledModelRelationalTestBase.SpatialTypes @this) + => GetId(@this); + + public static void WriteId(CompiledModelRelationalTestBase.SpatialTypes @this, int value) + => GetId(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/DependentBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/DependentBaseEntityType.cs index a21f4920664..f392113e4c2 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/DependentBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/DependentBaseEntityType.cs @@ -1,11 +1,16 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable @@ -32,6 +37,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = SqlServerByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -45,12 +71,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? (int)(byte)v : 0, (Nullable v) => v.HasValue ? (Nullable)(byte)v : default(Nullable))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalId = runtimeEntityType.AddProperty( "PrincipalId", typeof(long?), nullable: true); + principalId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 0); principalId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -64,6 +97,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); principalId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var key = runtimeEntityType.AddKey( @@ -94,6 +128,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -101,11 +156,63 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Dependent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot, Nullable>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalId) == null ? null : ((ValueComparer>)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalId))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot>(default(Nullable) == null ? null : ((ValueComparer>)principalId.GetValueComparer()).Snapshot(default(Nullable)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot>(default(Nullable))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot>(source.ContainsKey("PrincipalId") ? (Nullable)source["PrincipalId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot>(default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalId) == null ? null : ((ValueComparer>)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 3, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", "TPC"); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -117,5 +224,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetId(CompiledModelTestBase.DependentBase @this); + + public static byte? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, byte? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalBaseEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalBaseEntityType.cs index 1c29bcb9fd4..5a9bef3533c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalBaseEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalBaseEntityType.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -39,6 +42,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -52,6 +76,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var overrides = new StoreObjectDictionary(); var idPrincipalBaseView = new RuntimeRelationalPropertyOverrides( @@ -71,6 +96,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueGenerated: ValueGenerated.OnAdd); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)CompiledModelTestBase.AnEnum.A), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)CompiledModelTestBase.AnEnum.A)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(1) && object.Equals((object)ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), (object)CompiledModelTestBase.AnEnum.A) ? entry.ReadTemporaryValue(0) : ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + enum1.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 0); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -112,6 +158,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum2.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -140,6 +207,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[3]); + flagsEnum1.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -169,6 +257,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum2.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -197,6 +306,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas "PrincipalBaseId", typeof(long?), nullable: true); + principalBaseId.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 0, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -210,12 +325,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); principalBaseId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var principalDerivedId = runtimeEntityType.AddProperty( "PrincipalDerivedId", typeof(long?), nullable: true); + principalDerivedId.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 1, + relationshipIndex: 2, + storeGenerationIndex: 2); principalDerivedId.TypeMapping = SqlServerLongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -229,6 +351,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, (Nullable v) => v.HasValue ? ((long)v).GetHashCode() : 0, (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable))); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); principalDerivedId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None); var refTypeArray = runtimeEntityType.AddProperty( @@ -237,6 +360,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -301,6 +445,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -349,6 +514,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -397,6 +583,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -461,6 +668,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -504,6 +732,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -547,6 +796,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -590,6 +860,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqlServerStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -657,6 +948,33 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Deriveds", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + deriveds.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadDeriveds(instance) == null); + deriveds.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => PrincipalBaseEntityType.WriteDeriveds(entity, value)); + deriveds.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(deriveds), + null); + deriveds.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + deriveds.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => PrincipalBaseEntityType.WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } @@ -673,48 +991,119 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principals.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadPrincipals(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadPrincipals(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadPrincipals(instance) == null); + principals.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WritePrincipals(entity, value)); + principals.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WritePrincipals(entity, value)); + principals.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(principals), + null); + principals.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + principals.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), source.GetCurrentValue>(principalDerivedId) == null ? null : ((ValueComparer>)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalDerivedId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable>(((ValueComparer)enum1.GetValueComparer()).Snapshot(default(CompiledModelTestBase.AnEnum)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalDerivedId.GetValueComparer()).Snapshot(default(Nullable)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable>(default(CompiledModelTestBase.AnEnum), default(Nullable), default(Nullable))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot, Nullable>(source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null, source.ContainsKey("PrincipalDerivedId") ? (Nullable)source["PrincipalDerivedId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot, Nullable>(default(Nullable), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Nullable, Nullable, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), source.GetCurrentValue>(principalDerivedId) == null ? null : ((ValueComparer>)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalDerivedId)), SnapshotFactoryFactory.SnapshotCollection(ReadDeriveds(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 4, + storeGeneratedCount: 3); var insertSproc = new RuntimeStoredProcedure( runtimeEntityType, "PrincipalBase_Insert", "TPC", false); - var id = insertSproc.AddParameter( + var id0 = insertSproc.AddParameter( "Id", System.Data.ParameterDirection.Input, false, "Id", false); - var principalBaseId = insertSproc.AddParameter( + var principalBaseId0 = insertSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var principalDerivedId = insertSproc.AddParameter( + var principalDerivedId0 = insertSproc.AddParameter( "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); - var enum2 = insertSproc.AddParameter( + var enum20 = insertSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum1 = insertSproc.AddParameter( + var flagsEnum10 = insertSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum2 = insertSproc.AddParameter( + var flagsEnum20 = insertSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList = insertSproc.AddParameter( + var valueTypeList0 = insertSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList = insertSproc.AddParameter( + var valueTypeIList0 = insertSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray = insertSproc.AddParameter( + var valueTypeArray0 = insertSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable = insertSproc.AddParameter( + var valueTypeEnumerable0 = insertSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList = insertSproc.AddParameter( + var refTypeList0 = insertSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList = insertSproc.AddParameter( + var refTypeIList0 = insertSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray = insertSproc.AddParameter( + var refTypeArray0 = insertSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable = insertSproc.AddParameter( + var refTypeEnumerable0 = insertSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); - var enum1 = insertSproc.AddParameter( + var enum10 = insertSproc.AddParameter( "BaseEnum", System.Data.ParameterDirection.Output, false, "Enum1", false); - enum1.AddAnnotation("foo", "bar"); + enum10.AddAnnotation("foo", "bar"); insertSproc.AddAnnotation("foo", "bar1"); runtimeEntityType.AddAnnotation("Relational:InsertStoredProcedure", insertSproc); @@ -724,7 +1113,7 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) "TPC", true); - var id0 = deleteSproc.AddParameter( + var id1 = deleteSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:DeleteStoredProcedure", deleteSproc); @@ -734,35 +1123,35 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) "TPC", false); - var principalBaseId0 = updateSproc.AddParameter( + var principalBaseId1 = updateSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var principalDerivedId0 = updateSproc.AddParameter( + var principalDerivedId1 = updateSproc.AddParameter( "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); - var enum10 = updateSproc.AddParameter( + var enum11 = updateSproc.AddParameter( "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); - var enum20 = updateSproc.AddParameter( + var enum21 = updateSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum10 = updateSproc.AddParameter( + var flagsEnum11 = updateSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum20 = updateSproc.AddParameter( + var flagsEnum21 = updateSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList0 = updateSproc.AddParameter( + var valueTypeList1 = updateSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList0 = updateSproc.AddParameter( + var valueTypeIList1 = updateSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray0 = updateSproc.AddParameter( + var valueTypeArray1 = updateSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable0 = updateSproc.AddParameter( + var valueTypeEnumerable1 = updateSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList0 = updateSproc.AddParameter( + var refTypeList1 = updateSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList0 = updateSproc.AddParameter( + var refTypeIList1 = updateSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray0 = updateSproc.AddParameter( + var refTypeArray1 = updateSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable0 = updateSproc.AddParameter( + var refTypeEnumerable1 = updateSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); - var id1 = updateSproc.AddParameter( + var id2 = updateSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:UpdateStoredProcedure", updateSproc); @@ -779,5 +1168,131 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalDerivedEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalDerivedEntityType.cs index 7f65e1ce569..eb02f91204d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalDerivedEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Tpc/PrincipalDerivedEntityType.cs @@ -1,7 +1,13 @@ // using System; +using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; #pragma warning disable 219, 612, 618 @@ -26,39 +32,85 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var deriveds = runtimeEntityType.FindNavigation("Deriveds")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + var principals = runtimeEntityType.FindNavigation("Principals")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Nullable, Nullable, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), source.GetCurrentValue>(principalDerivedId) == null ? null : ((ValueComparer>)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue>(principalDerivedId)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Nullable>(((ValueComparer)enum1.GetValueComparer()).Snapshot(default(CompiledModelTestBase.AnEnum)), default(Nullable) == null ? null : ((ValueComparer>)principalBaseId.GetValueComparer()).Snapshot(default(Nullable)), default(Nullable) == null ? null : ((ValueComparer>)principalDerivedId.GetValueComparer()).Snapshot(default(Nullable)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Nullable>(default(CompiledModelTestBase.AnEnum), default(Nullable), default(Nullable))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot, Nullable>(source.ContainsKey("PrincipalBaseId") ? (Nullable)source["PrincipalBaseId"] : null, source.ContainsKey("PrincipalDerivedId") ? (Nullable)source["PrincipalDerivedId"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot, Nullable>(default(Nullable), default(Nullable))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Nullable, Nullable, object, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue>(principalBaseId) == null ? null : ((ValueComparer>)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalBaseId)), source.GetCurrentValue>(principalDerivedId) == null ? null : ((ValueComparer>)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(principalDerivedId)), SnapshotFactoryFactory.SnapshotCollection(PrincipalBaseEntityType.ReadDeriveds(entity)), ReadDependent(entity), SnapshotFactoryFactory.SnapshotCollection(ReadPrincipals(entity))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 3, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 2, + relationshipCount: 6, + storeGeneratedCount: 3); var insertSproc = new RuntimeStoredProcedure( runtimeEntityType, "Derived_Insert", "TPC", false); - var id = insertSproc.AddParameter( + var id0 = insertSproc.AddParameter( "Id", System.Data.ParameterDirection.Input, false, "Id", false); - var principalBaseId = insertSproc.AddParameter( + var principalBaseId0 = insertSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var principalDerivedId = insertSproc.AddParameter( + var principalDerivedId0 = insertSproc.AddParameter( "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); - var enum2 = insertSproc.AddParameter( + var enum20 = insertSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum1 = insertSproc.AddParameter( + var flagsEnum10 = insertSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum2 = insertSproc.AddParameter( + var flagsEnum20 = insertSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList = insertSproc.AddParameter( + var valueTypeList0 = insertSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList = insertSproc.AddParameter( + var valueTypeIList0 = insertSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray = insertSproc.AddParameter( + var valueTypeArray0 = insertSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable = insertSproc.AddParameter( + var valueTypeEnumerable0 = insertSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList = insertSproc.AddParameter( + var refTypeList0 = insertSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList = insertSproc.AddParameter( + var refTypeIList0 = insertSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray = insertSproc.AddParameter( + var refTypeArray0 = insertSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable = insertSproc.AddParameter( + var refTypeEnumerable0 = insertSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); var derivedEnum = insertSproc.AddResultColumn( "DerivedEnum", false, "Enum1"); @@ -71,7 +123,7 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) "TPC", false); - var id0 = deleteSproc.AddParameter( + var id1 = deleteSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:DeleteStoredProcedure", deleteSproc); @@ -81,35 +133,35 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) "Derived", false); - var principalBaseId0 = updateSproc.AddParameter( + var principalBaseId1 = updateSproc.AddParameter( "PrincipalBaseId", System.Data.ParameterDirection.Input, false, "PrincipalBaseId", false); - var principalDerivedId0 = updateSproc.AddParameter( + var principalDerivedId1 = updateSproc.AddParameter( "PrincipalDerivedId", System.Data.ParameterDirection.Input, false, "PrincipalDerivedId", false); - var enum1 = updateSproc.AddParameter( + var enum10 = updateSproc.AddParameter( "Enum1", System.Data.ParameterDirection.Input, false, "Enum1", false); - var enum20 = updateSproc.AddParameter( + var enum21 = updateSproc.AddParameter( "Enum2", System.Data.ParameterDirection.Input, false, "Enum2", false); - var flagsEnum10 = updateSproc.AddParameter( + var flagsEnum11 = updateSproc.AddParameter( "FlagsEnum1", System.Data.ParameterDirection.Input, false, "FlagsEnum1", false); - var flagsEnum20 = updateSproc.AddParameter( + var flagsEnum21 = updateSproc.AddParameter( "FlagsEnum2", System.Data.ParameterDirection.Input, false, "FlagsEnum2", false); - var valueTypeList0 = updateSproc.AddParameter( + var valueTypeList1 = updateSproc.AddParameter( "ValueTypeList", System.Data.ParameterDirection.Input, false, "ValueTypeList", false); - var valueTypeIList0 = updateSproc.AddParameter( + var valueTypeIList1 = updateSproc.AddParameter( "ValueTypeIList", System.Data.ParameterDirection.Input, false, "ValueTypeIList", false); - var valueTypeArray0 = updateSproc.AddParameter( + var valueTypeArray1 = updateSproc.AddParameter( "ValueTypeArray", System.Data.ParameterDirection.Input, false, "ValueTypeArray", false); - var valueTypeEnumerable0 = updateSproc.AddParameter( + var valueTypeEnumerable1 = updateSproc.AddParameter( "ValueTypeEnumerable", System.Data.ParameterDirection.Input, false, "ValueTypeEnumerable", false); - var refTypeList0 = updateSproc.AddParameter( + var refTypeList1 = updateSproc.AddParameter( "RefTypeList", System.Data.ParameterDirection.Input, false, "RefTypeList", false); - var refTypeIList0 = updateSproc.AddParameter( + var refTypeIList1 = updateSproc.AddParameter( "RefTypeIList", System.Data.ParameterDirection.Input, false, "RefTypeIList", false); - var refTypeArray0 = updateSproc.AddParameter( + var refTypeArray1 = updateSproc.AddParameter( "RefTypeArray", System.Data.ParameterDirection.Input, false, "RefTypeArray", false); - var refTypeEnumerable0 = updateSproc.AddParameter( + var refTypeEnumerable1 = updateSproc.AddParameter( "RefTypeEnumerable", System.Data.ParameterDirection.Input, false, "RefTypeEnumerable", false); - var id1 = updateSproc.AddParameter( + var id2 = updateSproc.AddParameter( "Id_Original", System.Data.ParameterDirection.Input, false, "Id", true); runtimeEntityType.AddAnnotation("Relational:UpdateStoredProcedure", updateSproc); @@ -125,5 +177,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetPrincipals(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadPrincipals(CompiledModelTestBase.PrincipalDerived> @this) + => GetPrincipals(@this); + + public static void WritePrincipals(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetPrincipals(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs index 2c8d5dde4dd..d767ca70c19 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -44,6 +54,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v1, int v2) => v1 == v2, (int v) => v, (int v) => v)); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); id.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); var blob = runtimeEntityType.AddProperty( @@ -52,19 +63,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqlServerByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "varbinary(max)"), storeTypePostfix: StoreTypePostfix.None); @@ -85,6 +117,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -97,5 +159,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs index 837f581ba65..c129ad1a9ef 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs @@ -54,14 +54,12 @@ protected override void BuildBigModel(ModelBuilder modelBuilder, bool jsonColumn modelBuilder.Entity>>( eb => { - eb.OwnsMany( - typeof(OwnedType).FullName!, "ManyOwned", ob => - { - if (!jsonColumns) + eb.HasMany(e => e.Principals).WithMany(e => (ICollection>>)e.Deriveds) + .UsingEntity( + jb => { - ob.ToTable("ManyOwned", t => t.IsMemoryOptimized()); - } - }); + jb.ToTable(tb => tb.IsMemoryOptimized()); + }); }); modelBuilder.Entity( @@ -157,17 +155,12 @@ protected override void AssertBigModel(IModel model, bool jsonColumns) var principalDerived = model.FindEntityType(typeof(PrincipalDerived>))!; var ownedCollectionNavigation = principalDerived.GetDeclaredNavigations().Last(); var collectionOwnedType = ownedCollectionNavigation.TargetEntityType; - if (jsonColumns) - { - Assert.False(collectionOwnedType.IsMemoryOptimized()); - } - else - { - Assert.True(collectionOwnedType.IsMemoryOptimized()); - } + Assert.False(collectionOwnedType.IsMemoryOptimized()); var derivedSkipNavigation = principalDerived.GetDeclaredSkipNavigations().Single(); var joinType = derivedSkipNavigation.JoinEntityType; + Assert.True(joinType.IsMemoryOptimized()); + var rowid = joinType.GetProperties().Single(p => !p.IsForeignKey()); Assert.Equal("rowversion", rowid.GetColumnType()); Assert.Equal(SqlServerValueGenerationStrategy.None, rowid.GetValueGenerationStrategy()); diff --git a/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj b/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj index f3700d3d548..49f7e3dbfc8 100644 --- a/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj +++ b/test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj @@ -64,4 +64,8 @@ + + + + diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DataEntityType.cs index 14543870017..f3997cd08a5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -32,6 +36,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -47,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -54,24 +65,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var point = runtimeEntityType.AddProperty( "Point", typeof(Point), nullable: true); + point.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 1, + relationshipIndex: -1, + storeGenerationIndex: -1); point.TypeMapping = null; var key = runtimeEntityType.AddKey( @@ -83,6 +121,37 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + var point = runtimeEntityType.FindProperty("Point")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0, source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int), default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 3, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 3, + shadowCount: 2, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -94,5 +163,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs index 6ade69519bf..0f6385004bd 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentBaseEntityType.cs @@ -1,9 +1,13 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -38,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -53,19 +63,33 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); var principalAlternateId = runtimeEntityType.AddProperty( "PrincipalAlternateId", typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalAlternateId)); var enumDiscriminator = runtimeEntityType.AddProperty( "EnumDiscriminator", typeof(CompiledModelTestBase.Enum1), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + enumDiscriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: -1, + storeGenerationIndex: -1); enumDiscriminator.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum1 v1, CompiledModelTestBase.Enum1 v2) => object.Equals((object)v1, (object)v2), @@ -97,6 +121,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[3]); + id.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -152,6 +197,27 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -161,11 +227,65 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt eagerLoaded: true, lazyLoadingEnabled: false); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 4, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 4, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("DiscriminatorMappingComplete", false); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); @@ -179,5 +299,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetId(CompiledModelTestBase.DependentBase @this); + + public static byte? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, byte? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs index c3e79cfbe6f..c471955bce5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/DependentDerivedEntityType.cs @@ -1,9 +1,15 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable @@ -30,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 20, unicode: false); + data.SetGetter( + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity), + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity) == null, + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance), + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance) == null); + data.SetSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetMaterializationSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetAccessors( + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(data, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(data), + (ValueBuffer valueBuffer) => valueBuffer[4]); + data.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); data.TypeMapping = SqliteStringTypeMapping.Default; data.AddAnnotation("Relational:IsFixedLength", true); @@ -39,6 +66,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas precision: 9, scale: 3, sentinel: 0m); + money.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 3, + relationshipIndex: -1, + storeGenerationIndex: -1); money.TypeMapping = SqliteDecimalTypeMapping.Default; return runtimeEntityType; @@ -46,6 +79,41 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var data = runtimeEntityType.FindProperty("Data")!; + var money = runtimeEntityType.FindProperty("Money")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot, string, decimal>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(data) == null ? null : ((ValueComparer)data.GetValueComparer()).Snapshot(source.GetCurrentValue(data)), ((ValueComparer)money.GetValueComparer()).Snapshot(source.GetCurrentValue(money))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default, source.ContainsKey("Money") ? (decimal)source["Money"] : 0M)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1), default(decimal))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), DependentBaseEntityType.ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 6, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 6, + shadowCount: 4, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -57,5 +125,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetData(CompiledModelTestBase.DependentDerived @this); + + public static string ReadData(CompiledModelTestBase.DependentDerived @this) + => GetData(@this); + + public static void WriteData(CompiledModelTestBase.DependentDerived @this, string value) + => GetData(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs index 6c5cb015ebc..113d9701fac 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/ManyTypesEntityType.cs @@ -7,9 +7,12 @@ using System.Net; using System.Net.NetworkInformation; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -42,6 +45,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, valueConverter: new CompiledModelTestBase.ManyTypesIdConverter()); + id.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity).Equals(default(CompiledModelTestBase.ManyTypesId)), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance).Equals(default(CompiledModelTestBase.ManyTypesId))); + id.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelTestBase.ManyTypes)entry.Entity).Equals(default(CompiledModelTestBase.ManyTypesId)) ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.ManyTypesId v1, CompiledModelTestBase.ManyTypesId v2) => v1.Equals(v2), @@ -65,6 +89,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (CompiledModelTestBase.ManyTypesId v) => v.Id, (int v) => new CompiledModelTestBase.ManyTypesId(v)))); + id.SetCurrentValueComparer(new CurrentProviderValueComparer(id)); id.SetSentinelFromProviderValue(0); var @bool = runtimeEntityType.AddProperty( @@ -73,6 +98,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + @bool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance) == false); + @bool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetAccessors( + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@bool, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(@bool), + (ValueBuffer valueBuffer) => valueBuffer[1]); + @bool.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @bool.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -94,6 +140,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance) == null); + boolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetAccessors( + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolArray, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolArray), + (ValueBuffer valueBuffer) => valueBuffer[2]); + boolArray.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -132,6 +199,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance) == false); + boolToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToStringConverterProperty, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[3]); + boolToStringConverterProperty.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -162,6 +250,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToTwoValuesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToTwoValuesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance) == false); + boolToTwoValuesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToTwoValuesConverterProperty, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToTwoValuesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[4]); + boolToTwoValuesConverterProperty.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToTwoValuesConverterProperty.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -193,6 +302,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToZeroOneConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BoolToZeroOneConverter()); + boolToZeroOneConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance) == false); + boolToZeroOneConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToZeroOneConverterProperty, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToZeroOneConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[5]); + boolToZeroOneConverterProperty.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToZeroOneConverterProperty.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -223,34 +353,76 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance) == null); + bytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetAccessors( + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytes, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytes), + (ValueBuffer valueBuffer) => valueBuffer[6]); + bytes.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytes.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var bytesArray = runtimeEntityType.AddProperty( "BytesArray", typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance) == null); + bytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + bytesArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -261,17 +433,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas SqliteJsonByteArrayReaderWriter.Instance), elementMapping: SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()))); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()))); var bytesToStringConverterProperty = runtimeEntityType.AddProperty( "BytesToStringConverterProperty", @@ -280,26 +452,47 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BytesToStringConverter(), valueComparer: new ArrayStructuralComparer()); + bytesToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance) == null); + bytesToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesToStringConverterProperty, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[8]); + bytesToStringConverterProperty.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), converter: new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonStringReaderWriter.Instance, new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)))); var castingConverterProperty = runtimeEntityType.AddProperty( @@ -308,6 +501,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CastingConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CastingConverter()); + castingConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance) == 0); + castingConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(castingConverterProperty, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(castingConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[9]); + castingConverterProperty.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); castingConverterProperty.TypeMapping = SqliteDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -337,6 +551,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Char", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: '\0'); + @char.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance) == '\0'); + @char.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetAccessors( + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@char, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(@char), + (ValueBuffer valueBuffer) => valueBuffer[10]); + @char.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @char.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -358,6 +593,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + charArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance) == null); + charArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetAccessors( + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(charArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + charArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (char v1, char v2) => v1 == v2, @@ -397,6 +653,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CharToStringConverter()); + charToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance) == '\0'); + charToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charToStringConverterProperty, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(charToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[12]); + charToStringConverterProperty.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -428,6 +705,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateOnly(1, 1, 1)); + dateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance) == default(DateOnly)); + dateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnly, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnly), + (ValueBuffer valueBuffer) => valueBuffer[13]); + dateOnly.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnly.TypeMapping = SqliteDateOnlyTypeMapping.Default; var dateOnlyArray = runtimeEntityType.AddProperty( @@ -435,6 +733,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance) == null); + dateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyArray, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[14]); + dateOnlyArray.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -460,6 +779,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateOnlyToStringConverter()); + dateOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance) == default(DateOnly)); + dateOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyToStringConverterProperty, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[15]); + dateOnlyToStringConverterProperty.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -491,6 +831,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance) == default(DateTime)); + dateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetAccessors( + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTime, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTime), + (ValueBuffer valueBuffer) => valueBuffer[16]); + dateTime.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var dateTimeArray = runtimeEntityType.AddProperty( @@ -498,6 +859,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance) == null); + dateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + dateTimeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -523,6 +905,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBinaryConverter()); + dateTimeOffsetToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBinaryConverterProperty, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[18]); + dateTimeOffsetToBinaryConverterProperty.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBinaryConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -554,6 +957,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBytesConverter()); + dateTimeOffsetToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBytesConverterProperty, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[19]); + dateTimeOffsetToBytesConverterProperty.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -564,19 +988,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (DateTimeOffset v) => v.GetHashCode(), (DateTimeOffset v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 12), converter: new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); dateTimeOffsetToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var dateTimeOffsetToStringConverterProperty = runtimeEntityType.AddProperty( @@ -585,6 +1009,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToStringConverter()); + dateTimeOffsetToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToStringConverterProperty, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[20]); + dateTimeOffsetToStringConverterProperty.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -616,6 +1061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToBinaryConverter()); + dateTimeToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance) == default(DateTime)); + dateTimeToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToBinaryConverterProperty, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[21]); + dateTimeToBinaryConverterProperty.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToBinaryConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -647,6 +1113,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToStringConverter()); + dateTimeToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance) == default(DateTime)); + dateTimeToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToStringConverterProperty, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[22]); + dateTimeToStringConverterProperty.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -678,6 +1165,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTimeToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance) == default(DateTime)); + dateTimeToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToTicksConverterProperty, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[23]); + dateTimeToTicksConverterProperty.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToTicksConverterProperty.TypeMapping = SqliteDateTimeTypeMapping.Default; var @decimal = runtimeEntityType.AddProperty( @@ -686,6 +1194,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Decimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0m); + @decimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance) == 0M); + @decimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetAccessors( + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@decimal, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue(@decimal), + (ValueBuffer valueBuffer) => valueBuffer[24]); + @decimal.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @decimal.TypeMapping = SqliteDecimalTypeMapping.Default; var decimalArray = runtimeEntityType.AddProperty( @@ -693,6 +1222,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + decimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance) == null); + decimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalArray, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalArray), + (ValueBuffer valueBuffer) => valueBuffer[25]); + decimalArray.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -718,6 +1268,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + decimalNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance) == 0M); + decimalNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToBytesConverterProperty, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[26]); + decimalNumberToBytesConverterProperty.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -728,19 +1299,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); decimalNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var decimalNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -749,6 +1320,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + decimalNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance) == 0M); + decimalNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToStringConverterProperty, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[27]); + decimalNumberToStringConverterProperty.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -780,6 +1372,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Double", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0.0); + @double.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance).Equals(0D)); + @double.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetAccessors( + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@double, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(@double), + (ValueBuffer valueBuffer) => valueBuffer[28]); + @double.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @double.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -801,6 +1414,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + doubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance) == null); + doubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleArray, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleArray), + (ValueBuffer valueBuffer) => valueBuffer[29]); + doubleArray.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -840,6 +1474,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + doubleNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance).Equals(0D)); + doubleNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToBytesConverterProperty, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[30]); + doubleNumberToBytesConverterProperty.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -850,19 +1505,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (double v) => v.GetHashCode(), (double v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 8), converter: new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); doubleNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }); var doubleNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -871,6 +1526,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + doubleNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance).Equals(0D)); + doubleNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToStringConverterProperty, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[31]); + doubleNumberToStringConverterProperty.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -901,6 +1577,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16), + (ValueBuffer valueBuffer) => valueBuffer[32]); + enum16.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -931,6 +1628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance) == null); + enum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16Array, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16Array), + (ValueBuffer valueBuffer) => valueBuffer[33]); + enum16Array.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -986,6 +1704,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16AsString(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16AsString(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsString, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[34]); + enum16AsString.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1014,6 +1753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance) == null); + enum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsStringArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + enum16AsStringArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1066,6 +1826,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance) == null); + enum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16AsStringCollection, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[36]); + enum16AsStringCollection.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1118,6 +1899,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance) == null); + enum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16Collection, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[37]); + enum16Collection.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1172,6 +1974,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32), + (ValueBuffer valueBuffer) => valueBuffer[38]); + enum32.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1202,6 +2025,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance) == null); + enum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32Array, 39), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32Array), + (ValueBuffer valueBuffer) => valueBuffer[39]); + enum32Array.SetPropertyIndexes( + index: 39, + originalValueIndex: 39, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1257,6 +2101,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32AsString(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32AsString(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsString, 40), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[40]); + enum32AsString.SetPropertyIndexes( + index: 40, + originalValueIndex: 40, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1285,6 +2150,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance) == null); + enum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsStringArray, 41), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[41]); + enum32AsStringArray.SetPropertyIndexes( + index: 41, + originalValueIndex: 41, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1337,6 +2223,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance) == null); + enum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32AsStringCollection, 42), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[42]); + enum32AsStringCollection.SetPropertyIndexes( + index: 42, + originalValueIndex: 42, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1389,6 +2296,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance) == null); + enum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32Collection, 43), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[43]); + enum32Collection.SetPropertyIndexes( + index: 43, + originalValueIndex: 43, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1443,6 +2371,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64, 44), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64), + (ValueBuffer valueBuffer) => valueBuffer[44]); + enum64.SetPropertyIndexes( + index: 44, + originalValueIndex: 44, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1473,6 +2422,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance) == null); + enum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64Array, 45), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64Array), + (ValueBuffer valueBuffer) => valueBuffer[45]); + enum64Array.SetPropertyIndexes( + index: 45, + originalValueIndex: 45, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1528,6 +2498,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64AsString(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64AsString(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsString, 46), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[46]); + enum64AsString.SetPropertyIndexes( + index: 46, + originalValueIndex: 46, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1556,6 +2547,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance) == null); + enum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsStringArray, 47), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[47]); + enum64AsStringArray.SetPropertyIndexes( + index: 47, + originalValueIndex: 47, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1608,6 +2620,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance) == null); + enum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64AsStringCollection, 48), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[48]); + enum64AsStringCollection.SetPropertyIndexes( + index: 48, + originalValueIndex: 48, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1660,6 +2693,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance) == null); + enum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64Collection, 49), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[49]); + enum64Collection.SetPropertyIndexes( + index: 49, + originalValueIndex: 49, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1714,6 +2768,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8, 50), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8), + (ValueBuffer valueBuffer) => valueBuffer[50]); + enum8.SetPropertyIndexes( + index: 50, + originalValueIndex: 50, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1744,6 +2819,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance) == null); + enum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8Array, 51), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8Array), + (ValueBuffer valueBuffer) => valueBuffer[51]); + enum8Array.SetPropertyIndexes( + index: 51, + originalValueIndex: 51, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1799,6 +2895,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8AsString(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8AsString(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsString, 52), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[52]); + enum8AsString.SetPropertyIndexes( + index: 52, + originalValueIndex: 52, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1827,6 +2944,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance) == null); + enum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsStringArray, 53), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[53]); + enum8AsStringArray.SetPropertyIndexes( + index: 53, + originalValueIndex: 53, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1879,6 +3017,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance) == null); + enum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8AsStringCollection, 54), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[54]); + enum8AsStringCollection.SetPropertyIndexes( + index: 54, + originalValueIndex: 54, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1931,6 +3090,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance) == null); + enum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8Collection, 55), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[55]); + enum8Collection.SetPropertyIndexes( + index: 55, + originalValueIndex: 55, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1986,6 +3166,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToNumberConverter()); + enumToNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToNumberConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToNumberConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToNumberConverterProperty, 56), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[56]); + enumToNumberConverterProperty.SetPropertyIndexes( + index: 56, + originalValueIndex: 56, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2017,6 +3218,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToStringConverter()); + enumToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToStringConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToStringConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToStringConverterProperty, 57), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[57]); + enumToStringConverterProperty.SetPropertyIndexes( + index: 57, + originalValueIndex: 57, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2045,6 +3267,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16, 58), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16), + (ValueBuffer valueBuffer) => valueBuffer[58]); + enumU16.SetPropertyIndexes( + index: 58, + originalValueIndex: 58, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2075,6 +3318,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance) == null); + enumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16Array, 59), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[59]); + enumU16Array.SetPropertyIndexes( + index: 59, + originalValueIndex: 59, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2130,6 +3394,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16AsString(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16AsString(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsString, 60), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[60]); + enumU16AsString.SetPropertyIndexes( + index: 60, + originalValueIndex: 60, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2158,6 +3443,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance) == null); + enumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsStringArray, 61), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[61]); + enumU16AsStringArray.SetPropertyIndexes( + index: 61, + originalValueIndex: 61, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2210,6 +3516,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance) == null); + enumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16AsStringCollection, 62), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[62]); + enumU16AsStringCollection.SetPropertyIndexes( + index: 62, + originalValueIndex: 62, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2262,6 +3589,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance) == null); + enumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16Collection, 63), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[63]); + enumU16Collection.SetPropertyIndexes( + index: 63, + originalValueIndex: 63, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2316,6 +3664,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32, 64), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32), + (ValueBuffer valueBuffer) => valueBuffer[64]); + enumU32.SetPropertyIndexes( + index: 64, + originalValueIndex: 64, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2346,6 +3715,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance) == null); + enumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32Array, 65), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[65]); + enumU32Array.SetPropertyIndexes( + index: 65, + originalValueIndex: 65, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2401,6 +3791,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32AsString(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32AsString(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsString, 66), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[66]); + enumU32AsString.SetPropertyIndexes( + index: 66, + originalValueIndex: 66, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2429,6 +3840,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance) == null); + enumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsStringArray, 67), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[67]); + enumU32AsStringArray.SetPropertyIndexes( + index: 67, + originalValueIndex: 67, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2481,6 +3913,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance) == null); + enumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32AsStringCollection, 68), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[68]); + enumU32AsStringCollection.SetPropertyIndexes( + index: 68, + originalValueIndex: 68, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2533,6 +3986,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance) == null); + enumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32Collection, 69), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[69]); + enumU32Collection.SetPropertyIndexes( + index: 69, + originalValueIndex: 69, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2587,6 +4061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64, 70), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64), + (ValueBuffer valueBuffer) => valueBuffer[70]); + enumU64.SetPropertyIndexes( + index: 70, + originalValueIndex: 70, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2615,6 +4110,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance) == null); + enumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64Array, 71), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[71]); + enumU64Array.SetPropertyIndexes( + index: 71, + originalValueIndex: 71, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2668,6 +4184,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64AsString(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64AsString(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsString, 72), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[72]); + enumU64AsString.SetPropertyIndexes( + index: 72, + originalValueIndex: 72, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2696,6 +4233,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance) == null); + enumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsStringArray, 73), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[73]); + enumU64AsStringArray.SetPropertyIndexes( + index: 73, + originalValueIndex: 73, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2748,6 +4306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance) == null); + enumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64AsStringCollection, 74), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[74]); + enumU64AsStringCollection.SetPropertyIndexes( + index: 74, + originalValueIndex: 74, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2800,6 +4379,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance) == null); + enumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64Collection, 75), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[75]); + enumU64Collection.SetPropertyIndexes( + index: 75, + originalValueIndex: 75, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2852,6 +4452,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8, 76), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8), + (ValueBuffer valueBuffer) => valueBuffer[76]); + enumU8.SetPropertyIndexes( + index: 76, + originalValueIndex: 76, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2882,6 +4503,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance) == null); + enumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8Array, 77), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[77]); + enumU8Array.SetPropertyIndexes( + index: 77, + originalValueIndex: 77, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2937,6 +4579,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8AsString(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8AsString(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsString, 78), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[78]); + enumU8AsString.SetPropertyIndexes( + index: 78, + originalValueIndex: 78, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2965,6 +4628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance) == null); + enumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsStringArray, 79), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[79]); + enumU8AsStringArray.SetPropertyIndexes( + index: 79, + originalValueIndex: 79, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3017,6 +4701,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance) == null); + enumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8AsStringCollection, 80), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[80]); + enumU8AsStringCollection.SetPropertyIndexes( + index: 80, + originalValueIndex: 80, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3069,6 +4774,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance) == null); + enumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8Collection, 81), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[81]); + enumU8Collection.SetPropertyIndexes( + index: 81, + originalValueIndex: 81, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3124,6 +4850,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Float", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0f); + @float.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity).Equals(0F), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance).Equals(0F)); + @float.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetAccessors( + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@float, 82), + (InternalEntityEntry entry) => entry.GetCurrentValue(@float), + (ValueBuffer valueBuffer) => valueBuffer[82]); + @float.SetPropertyIndexes( + index: 82, + originalValueIndex: 82, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @float.TypeMapping = FloatTypeMapping.Default.Clone( comparer: new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3145,6 +4892,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("FloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + floatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance) == null); + floatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetAccessors( + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(floatArray, 83), + (InternalEntityEntry entry) => entry.GetCurrentValue(floatArray), + (ValueBuffer valueBuffer) => valueBuffer[83]); + floatArray.SetPropertyIndexes( + index: 83, + originalValueIndex: 83, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); floatArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3184,6 +4952,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Guid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetAccessors( + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guid, 84), + (InternalEntityEntry entry) => entry.GetCurrentValue(guid), + (ValueBuffer valueBuffer) => valueBuffer[84]); + guid.SetPropertyIndexes( + index: 84, + originalValueIndex: 84, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guid.TypeMapping = SqliteGuidTypeMapping.Default; var guidArray = runtimeEntityType.AddProperty( @@ -3191,6 +4980,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + guidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance) == null); + guidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetAccessors( + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidArray, 85), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidArray), + (ValueBuffer valueBuffer) => valueBuffer[85]); + guidArray.SetPropertyIndexes( + index: 85, + originalValueIndex: 85, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3216,6 +5026,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToBytesConverter()); + guidToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToBytesConverterProperty, 86), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[86]); + guidToBytesConverterProperty.SetPropertyIndexes( + index: 86, + originalValueIndex: 86, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3226,19 +5057,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v.GetHashCode(), (Guid v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)), + (byte[] v) => new Guid(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)))); + (byte[] v) => new Guid(v)))); guidToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var guidToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3247,6 +5078,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToStringConverter()); + guidToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToStringConverterProperty, 87), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[87]); + guidToStringConverterProperty.SetPropertyIndexes( + index: 87, + originalValueIndex: 87, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3277,6 +5129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance) == null); + iPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddress, 88), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddress), + (ValueBuffer valueBuffer) => valueBuffer[88]); + iPAddress.SetPropertyIndexes( + index: 88, + originalValueIndex: 88, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3306,6 +5179,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance) == null); + iPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressArray, 89), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[89]); + iPAddressArray.SetPropertyIndexes( + index: 89, + originalValueIndex: 89, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3361,6 +5255,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToBytesConverter()); + iPAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance) == null); + iPAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToBytesConverterProperty, 90), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[90]); + iPAddressToBytesConverterProperty.SetPropertyIndexes( + index: 90, + originalValueIndex: 90, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3371,19 +5286,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (IPAddress v) => v.GetHashCode(), (IPAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)), + (byte[] v) => new IPAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)))); + (byte[] v) => new IPAddress(v)))); var iPAddressToStringConverterProperty = runtimeEntityType.AddProperty( "IPAddressToStringConverterProperty", @@ -3391,6 +5306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToStringConverter()); + iPAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance) == null); + iPAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToStringConverterProperty, 91), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[91]); + iPAddressToStringConverterProperty.SetPropertyIndexes( + index: 91, + originalValueIndex: 91, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3421,6 +5357,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); + int16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance) == 0); + int16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetAccessors( + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16, 92), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16), + (ValueBuffer valueBuffer) => valueBuffer[92]); + int16.SetPropertyIndexes( + index: 92, + originalValueIndex: 92, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (short v1, short v2) => v1 == v2, @@ -3442,6 +5399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance) == null); + int16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16Array, 93), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16Array), + (ValueBuffer valueBuffer) => valueBuffer[93]); + int16Array.SetPropertyIndexes( + index: 93, + originalValueIndex: 93, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -3481,6 +5459,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + int32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance) == 0); + int32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetAccessors( + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32, 94), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32), + (ValueBuffer valueBuffer) => valueBuffer[94]); + int32.SetPropertyIndexes( + index: 94, + originalValueIndex: 94, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3502,6 +5501,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance) == null); + int32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32Array, 95), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32Array), + (ValueBuffer valueBuffer) => valueBuffer[95]); + int32Array.SetPropertyIndexes( + index: 95, + originalValueIndex: 95, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3541,6 +5561,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0L); + int64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity) == 0L, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance) == 0L); + int64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetAccessors( + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64, 96), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64), + (ValueBuffer valueBuffer) => valueBuffer[96]); + int64.SetPropertyIndexes( + index: 96, + originalValueIndex: 96, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -3562,6 +5603,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance) == null); + int64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64Array, 97), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64Array), + (ValueBuffer valueBuffer) => valueBuffer[97]); + int64Array.SetPropertyIndexes( + index: 97, + originalValueIndex: 97, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (long v1, long v2) => v1 == v2, @@ -3601,6 +5663,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (sbyte)0); + int8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance) == 0); + int8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetAccessors( + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8, 98), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8), + (ValueBuffer valueBuffer) => valueBuffer[98]); + int8.SetPropertyIndexes( + index: 98, + originalValueIndex: 98, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -3622,6 +5705,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance) == null); + int8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8Array, 99), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8Array), + (ValueBuffer valueBuffer) => valueBuffer[99]); + int8Array.SetPropertyIndexes( + index: 99, + originalValueIndex: 99, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -3661,6 +5765,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + intNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance) == 0); + intNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToBytesConverterProperty, 100), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[100]); + intNumberToBytesConverterProperty.SetPropertyIndexes( + index: 100, + originalValueIndex: 100, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3671,19 +5796,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v, (int v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 4), converter: new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); intNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0 }); var intNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3692,6 +5817,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + intNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance) == 0); + intNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToStringConverterProperty, 101), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[101]); + intNumberToStringConverterProperty.SetPropertyIndexes( + index: 101, + originalValueIndex: 101, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3724,6 +5870,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, valueConverter: new CompiledModelTestBase.NullIntToNullStringConverter()); + nullIntToNullStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullIntToNullStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullIntToNullStringConverterProperty(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullIntToNullStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullIntToNullStringConverterProperty(instance).HasValue); + nullIntToNullStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullIntToNullStringConverterProperty, 102), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullIntToNullStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[102]); + nullIntToNullStringConverterProperty.SetPropertyIndexes( + index: 102, + originalValueIndex: 102, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullIntToNullStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1 == v2, @@ -3754,6 +5921,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBool(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableBool(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBool(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableBool(instance).HasValue); + nullableBool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableBool, 103), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableBool), + (ValueBuffer valueBuffer) => valueBuffer[103]); + nullableBool.SetPropertyIndexes( + index: 103, + originalValueIndex: 103, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBool.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -3775,6 +5963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBoolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance) == null); + nullableBoolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableBoolArray, 104), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableBoolArray), + (ValueBuffer valueBuffer) => valueBuffer[104]); + nullableBoolArray.SetPropertyIndexes( + index: 104, + originalValueIndex: 104, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBoolArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -3814,34 +6023,76 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance) == null); + nullableBytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytes, 105), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytes), + (ValueBuffer valueBuffer) => valueBuffer[105]); + nullableBytes.SetPropertyIndexes( + index: 105, + originalValueIndex: 105, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytes.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var nullableBytesArray = runtimeEntityType.AddProperty( "NullableBytesArray", typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance) == null); + nullableBytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytesArray, 106), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytesArray), + (ValueBuffer valueBuffer) => valueBuffer[106]); + nullableBytesArray.SetPropertyIndexes( + index: 106, + originalValueIndex: 106, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytesArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -3852,17 +6103,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas SqliteJsonByteArrayReaderWriter.Instance), elementMapping: SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()))); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()))); var nullableChar = runtimeEntityType.AddProperty( "NullableChar", @@ -3870,6 +6121,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableChar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableChar.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableChar(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableChar(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableChar(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableChar(instance).HasValue); + nullableChar.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetAccessors( + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableChar, 107), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableChar), + (ValueBuffer valueBuffer) => valueBuffer[107]); + nullableChar.SetPropertyIndexes( + index: 107, + originalValueIndex: 107, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableChar.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -3891,6 +6163,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableCharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableCharArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance) == null); + nullableCharArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableCharArray, 108), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableCharArray), + (ValueBuffer valueBuffer) => valueBuffer[108]); + nullableCharArray.SetPropertyIndexes( + index: 108, + originalValueIndex: 108, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableCharArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -3930,6 +6223,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateOnly(instance).HasValue); + nullableDateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateOnly, 109), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateOnly), + (ValueBuffer valueBuffer) => valueBuffer[109]); + nullableDateOnly.SetPropertyIndexes( + index: 109, + originalValueIndex: 109, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnly.TypeMapping = SqliteDateOnlyTypeMapping.Default; var nullableDateOnlyArray = runtimeEntityType.AddProperty( @@ -3937,6 +6251,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance) == null); + nullableDateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateOnlyArray, 110), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[110]); + nullableDateOnlyArray.SetPropertyIndexes( + index: 110, + originalValueIndex: 110, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -3962,6 +6297,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateTime(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateTime(instance).HasValue); + nullableDateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateTime, 111), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateTime), + (ValueBuffer valueBuffer) => valueBuffer[111]); + nullableDateTime.SetPropertyIndexes( + index: 111, + originalValueIndex: 111, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var nullableDateTimeArray = runtimeEntityType.AddProperty( @@ -3969,6 +6325,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance) == null); + nullableDateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateTimeArray, 112), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[112]); + nullableDateTimeArray.SetPropertyIndexes( + index: 112, + originalValueIndex: 112, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTimeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -3994,6 +6371,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDecimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDecimal(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDecimal(instance).HasValue); + nullableDecimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDecimal, 113), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDecimal), + (ValueBuffer valueBuffer) => valueBuffer[113]); + nullableDecimal.SetPropertyIndexes( + index: 113, + originalValueIndex: 113, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimal.TypeMapping = SqliteDecimalTypeMapping.Default; var nullableDecimalArray = runtimeEntityType.AddProperty( @@ -4001,6 +6399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDecimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance) == null); + nullableDecimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDecimalArray, 114), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDecimalArray), + (ValueBuffer valueBuffer) => valueBuffer[114]); + nullableDecimalArray.SetPropertyIndexes( + index: 114, + originalValueIndex: 114, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimalArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4026,6 +6445,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDouble", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDouble.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDouble(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDouble(instance).HasValue); + nullableDouble.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDouble, 115), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDouble), + (ValueBuffer valueBuffer) => valueBuffer[115]); + nullableDouble.SetPropertyIndexes( + index: 115, + originalValueIndex: 115, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDouble.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4047,6 +6487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDoubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance) == null); + nullableDoubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDoubleArray, 116), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDoubleArray), + (ValueBuffer valueBuffer) => valueBuffer[116]); + nullableDoubleArray.SetPropertyIndexes( + index: 116, + originalValueIndex: 116, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDoubleArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4086,6 +6547,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16(instance).HasValue); + nullableEnum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16, 117), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16), + (ValueBuffer valueBuffer) => valueBuffer[117]); + nullableEnum16.SetPropertyIndexes( + index: 117, + originalValueIndex: 117, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4115,6 +6597,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance) == null); + nullableEnum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16Array, 118), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16Array), + (ValueBuffer valueBuffer) => valueBuffer[118]); + nullableEnum16Array.SetPropertyIndexes( + index: 118, + originalValueIndex: 118, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4170,6 +6673,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16AsString(instance).HasValue); + nullableEnum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16AsString, 119), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[119]); + nullableEnum16AsString.SetPropertyIndexes( + index: 119, + originalValueIndex: 119, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsString.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4199,6 +6723,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance) == null); + nullableEnum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16AsStringArray, 120), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[120]); + nullableEnum16AsStringArray.SetPropertyIndexes( + index: 120, + originalValueIndex: 120, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4253,6 +6798,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance) == null); + nullableEnum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16AsStringCollection, 121), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[121]); + nullableEnum16AsStringCollection.SetPropertyIndexes( + index: 121, + originalValueIndex: 121, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4307,6 +6873,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance) == null); + nullableEnum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16Collection, 122), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[122]); + nullableEnum16Collection.SetPropertyIndexes( + index: 122, + originalValueIndex: 122, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4362,6 +6949,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32(instance).HasValue); + nullableEnum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32, 123), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32), + (ValueBuffer valueBuffer) => valueBuffer[123]); + nullableEnum32.SetPropertyIndexes( + index: 123, + originalValueIndex: 123, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4391,6 +6999,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance) == null); + nullableEnum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32Array, 124), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32Array), + (ValueBuffer valueBuffer) => valueBuffer[124]); + nullableEnum32Array.SetPropertyIndexes( + index: 124, + originalValueIndex: 124, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4446,6 +7075,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32AsString(instance).HasValue); + nullableEnum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32AsString, 125), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[125]); + nullableEnum32AsString.SetPropertyIndexes( + index: 125, + originalValueIndex: 125, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4475,6 +7125,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance) == null); + nullableEnum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32AsStringArray, 126), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[126]); + nullableEnum32AsStringArray.SetPropertyIndexes( + index: 126, + originalValueIndex: 126, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4529,6 +7200,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance) == null); + nullableEnum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32AsStringCollection, 127), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[127]); + nullableEnum32AsStringCollection.SetPropertyIndexes( + index: 127, + originalValueIndex: 127, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4583,6 +7275,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance) == null); + nullableEnum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32Collection, 128), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[128]); + nullableEnum32Collection.SetPropertyIndexes( + index: 128, + originalValueIndex: 128, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4638,6 +7351,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64(instance).HasValue); + nullableEnum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64, 129), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64), + (ValueBuffer valueBuffer) => valueBuffer[129]); + nullableEnum64.SetPropertyIndexes( + index: 129, + originalValueIndex: 129, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4667,6 +7401,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance) == null); + nullableEnum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64Array, 130), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64Array), + (ValueBuffer valueBuffer) => valueBuffer[130]); + nullableEnum64Array.SetPropertyIndexes( + index: 130, + originalValueIndex: 130, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4722,6 +7477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64AsString(instance).HasValue); + nullableEnum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64AsString, 131), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[131]); + nullableEnum64AsString.SetPropertyIndexes( + index: 131, + originalValueIndex: 131, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsString.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4751,6 +7527,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance) == null); + nullableEnum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64AsStringArray, 132), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[132]); + nullableEnum64AsStringArray.SetPropertyIndexes( + index: 132, + originalValueIndex: 132, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4805,6 +7602,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance) == null); + nullableEnum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64AsStringCollection, 133), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[133]); + nullableEnum64AsStringCollection.SetPropertyIndexes( + index: 133, + originalValueIndex: 133, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4859,6 +7677,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance) == null); + nullableEnum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64Collection, 134), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[134]); + nullableEnum64Collection.SetPropertyIndexes( + index: 134, + originalValueIndex: 134, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4914,6 +7753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8(instance).HasValue); + nullableEnum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8, 135), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8), + (ValueBuffer valueBuffer) => valueBuffer[135]); + nullableEnum8.SetPropertyIndexes( + index: 135, + originalValueIndex: 135, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -4943,6 +7803,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance) == null); + nullableEnum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8Array, 136), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8Array), + (ValueBuffer valueBuffer) => valueBuffer[136]); + nullableEnum8Array.SetPropertyIndexes( + index: 136, + originalValueIndex: 136, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -4998,6 +7879,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8AsString(instance).HasValue); + nullableEnum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8AsString, 137), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[137]); + nullableEnum8AsString.SetPropertyIndexes( + index: 137, + originalValueIndex: 137, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsString.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5027,6 +7929,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance) == null); + nullableEnum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8AsStringArray, 138), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[138]); + nullableEnum8AsStringArray.SetPropertyIndexes( + index: 138, + originalValueIndex: 138, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5081,6 +8004,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance) == null); + nullableEnum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8AsStringCollection, 139), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[139]); + nullableEnum8AsStringCollection.SetPropertyIndexes( + index: 139, + originalValueIndex: 139, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5135,6 +8079,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance) == null); + nullableEnum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8Collection, 140), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[140]); + nullableEnum8Collection.SetPropertyIndexes( + index: 140, + originalValueIndex: 140, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5190,6 +8155,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16(instance).HasValue); + nullableEnumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16, 141), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16), + (ValueBuffer valueBuffer) => valueBuffer[141]); + nullableEnumU16.SetPropertyIndexes( + index: 141, + originalValueIndex: 141, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5219,6 +8205,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance) == null); + nullableEnumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16Array, 142), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[142]); + nullableEnumU16Array.SetPropertyIndexes( + index: 142, + originalValueIndex: 142, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5274,6 +8281,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16AsString(instance).HasValue); + nullableEnumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16AsString, 143), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[143]); + nullableEnumU16AsString.SetPropertyIndexes( + index: 143, + originalValueIndex: 143, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsString.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5303,6 +8331,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance) == null); + nullableEnumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16AsStringArray, 144), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[144]); + nullableEnumU16AsStringArray.SetPropertyIndexes( + index: 144, + originalValueIndex: 144, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5357,6 +8406,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance) == null); + nullableEnumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16AsStringCollection, 145), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[145]); + nullableEnumU16AsStringCollection.SetPropertyIndexes( + index: 145, + originalValueIndex: 145, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5411,6 +8481,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance) == null); + nullableEnumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16Collection, 146), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[146]); + nullableEnumU16Collection.SetPropertyIndexes( + index: 146, + originalValueIndex: 146, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5466,6 +8557,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32(instance).HasValue); + nullableEnumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32, 147), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32), + (ValueBuffer valueBuffer) => valueBuffer[147]); + nullableEnumU32.SetPropertyIndexes( + index: 147, + originalValueIndex: 147, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5495,6 +8607,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance) == null); + nullableEnumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32Array, 148), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[148]); + nullableEnumU32Array.SetPropertyIndexes( + index: 148, + originalValueIndex: 148, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5550,6 +8683,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32AsString(instance).HasValue); + nullableEnumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32AsString, 149), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[149]); + nullableEnumU32AsString.SetPropertyIndexes( + index: 149, + originalValueIndex: 149, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsString.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5579,6 +8733,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance) == null); + nullableEnumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32AsStringArray, 150), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[150]); + nullableEnumU32AsStringArray.SetPropertyIndexes( + index: 150, + originalValueIndex: 150, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5633,6 +8808,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance) == null); + nullableEnumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32AsStringCollection, 151), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[151]); + nullableEnumU32AsStringCollection.SetPropertyIndexes( + index: 151, + originalValueIndex: 151, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5687,6 +8883,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance) == null); + nullableEnumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32Collection, 152), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[152]); + nullableEnumU32Collection.SetPropertyIndexes( + index: 152, + originalValueIndex: 152, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5742,6 +8959,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64(instance).HasValue); + nullableEnumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64, 153), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64), + (ValueBuffer valueBuffer) => valueBuffer[153]); + nullableEnumU64.SetPropertyIndexes( + index: 153, + originalValueIndex: 153, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5769,6 +9007,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance) == null); + nullableEnumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64Array, 154), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[154]); + nullableEnumU64Array.SetPropertyIndexes( + index: 154, + originalValueIndex: 154, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5822,6 +9081,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64AsString(instance).HasValue); + nullableEnumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64AsString, 155), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[155]); + nullableEnumU64AsString.SetPropertyIndexes( + index: 155, + originalValueIndex: 155, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsString.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5849,6 +9129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance) == null); + nullableEnumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64AsStringArray, 156), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[156]); + nullableEnumU64AsStringArray.SetPropertyIndexes( + index: 156, + originalValueIndex: 156, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5901,6 +9202,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance) == null); + nullableEnumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64AsStringCollection, 157), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[157]); + nullableEnumU64AsStringCollection.SetPropertyIndexes( + index: 157, + originalValueIndex: 157, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5953,6 +9275,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance) == null); + nullableEnumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64Collection, 158), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[158]); + nullableEnumU64Collection.SetPropertyIndexes( + index: 158, + originalValueIndex: 158, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6006,6 +9349,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8(instance).HasValue); + nullableEnumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8, 159), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8), + (ValueBuffer valueBuffer) => valueBuffer[159]); + nullableEnumU8.SetPropertyIndexes( + index: 159, + originalValueIndex: 159, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6035,6 +9399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance) == null); + nullableEnumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8Array, 160), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[160]); + nullableEnumU8Array.SetPropertyIndexes( + index: 160, + originalValueIndex: 160, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6090,6 +9475,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8AsString(instance).HasValue); + nullableEnumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8AsString, 161), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[161]); + nullableEnumU8AsString.SetPropertyIndexes( + index: 161, + originalValueIndex: 161, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsString.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6119,6 +9525,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance) == null); + nullableEnumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8AsStringArray, 162), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[162]); + nullableEnumU8AsStringArray.SetPropertyIndexes( + index: 162, + originalValueIndex: 162, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6173,6 +9600,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance) == null); + nullableEnumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8AsStringCollection, 163), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[163]); + nullableEnumU8AsStringCollection.SetPropertyIndexes( + index: 163, + originalValueIndex: 163, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6227,6 +9675,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance) == null); + nullableEnumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8Collection, 164), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[164]); + nullableEnumU8Collection.SetPropertyIndexes( + index: 164, + originalValueIndex: 164, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6282,6 +9751,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloat", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableFloat.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableFloat(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableFloat(instance).HasValue); + nullableFloat.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableFloat, 165), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableFloat), + (ValueBuffer valueBuffer) => valueBuffer[165]); + nullableFloat.SetPropertyIndexes( + index: 165, + originalValueIndex: 165, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloat.TypeMapping = FloatTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -6303,6 +9793,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableFloatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance) == null); + nullableFloatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableFloatArray, 166), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableFloatArray), + (ValueBuffer valueBuffer) => valueBuffer[166]); + nullableFloatArray.SetPropertyIndexes( + index: 166, + originalValueIndex: 166, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloatArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -6342,6 +9853,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableGuid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableGuid(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableGuid(instance).HasValue); + nullableGuid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableGuid, 167), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableGuid), + (ValueBuffer valueBuffer) => valueBuffer[167]); + nullableGuid.SetPropertyIndexes( + index: 167, + originalValueIndex: 167, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuid.TypeMapping = SqliteGuidTypeMapping.Default; var nullableGuidArray = runtimeEntityType.AddProperty( @@ -6349,6 +9881,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableGuidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance) == null); + nullableGuidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableGuidArray, 168), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableGuidArray), + (ValueBuffer valueBuffer) => valueBuffer[168]); + nullableGuidArray.SetPropertyIndexes( + index: 168, + originalValueIndex: 168, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuidArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -6374,6 +9927,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableIPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance) == null); + nullableIPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddress, 169), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddress), + (ValueBuffer valueBuffer) => valueBuffer[169]); + nullableIPAddress.SetPropertyIndexes( + index: 169, + originalValueIndex: 169, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -6403,6 +9977,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableIPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance) == null); + nullableIPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddressArray, 170), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[170]); + nullableIPAddressArray.SetPropertyIndexes( + index: 170, + originalValueIndex: 170, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -6458,6 +10053,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt16(instance).HasValue); + nullableInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt16, 171), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt16), + (ValueBuffer valueBuffer) => valueBuffer[171]); + nullableInt16.SetPropertyIndexes( + index: 171, + originalValueIndex: 171, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -6479,6 +10095,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance) == null); + nullableInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt16Array, 172), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[172]); + nullableInt16Array.SetPropertyIndexes( + index: 172, + originalValueIndex: 172, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -6518,6 +10155,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt32(instance).HasValue); + nullableInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt32, 173), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt32), + (ValueBuffer valueBuffer) => valueBuffer[173]); + nullableInt32.SetPropertyIndexes( + index: 173, + originalValueIndex: 173, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -6539,6 +10197,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance) == null); + nullableInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt32Array, 174), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[174]); + nullableInt32Array.SetPropertyIndexes( + index: 174, + originalValueIndex: 174, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -6578,6 +10257,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt64(instance).HasValue); + nullableInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt64, 175), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt64), + (ValueBuffer valueBuffer) => valueBuffer[175]); + nullableInt64.SetPropertyIndexes( + index: 175, + originalValueIndex: 175, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -6599,6 +10299,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance) == null); + nullableInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt64Array, 176), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[176]); + nullableInt64Array.SetPropertyIndexes( + index: 176, + originalValueIndex: 176, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -6638,6 +10359,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt8(instance).HasValue); + nullableInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt8, 177), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt8), + (ValueBuffer valueBuffer) => valueBuffer[177]); + nullableInt8.SetPropertyIndexes( + index: 177, + originalValueIndex: 177, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -6659,6 +10401,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance) == null); + nullableInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt8Array, 178), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[178]); + nullableInt8Array.SetPropertyIndexes( + index: 178, + originalValueIndex: 178, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -6698,6 +10461,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullablePhysicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance) == null); + nullablePhysicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddress, 179), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[179]); + nullablePhysicalAddress.SetPropertyIndexes( + index: 179, + originalValueIndex: 179, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -6727,6 +10511,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullablePhysicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance) == null); + nullablePhysicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddressArray, 180), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[180]); + nullablePhysicalAddressArray.SetPropertyIndexes( + index: 180, + originalValueIndex: 180, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -6782,6 +10587,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance) == null); + nullableString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableString, 181), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableString), + (ValueBuffer valueBuffer) => valueBuffer[181]); + nullableString.SetPropertyIndexes( + index: 181, + originalValueIndex: 181, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableString.TypeMapping = SqliteStringTypeMapping.Default; var nullableStringArray = runtimeEntityType.AddProperty( @@ -6789,6 +10615,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance) == null); + nullableStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableStringArray, 182), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableStringArray), + (ValueBuffer valueBuffer) => valueBuffer[182]); + nullableStringArray.SetPropertyIndexes( + index: 182, + originalValueIndex: 182, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -6814,6 +10661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeOnly(instance).HasValue); + nullableTimeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeOnly, 183), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeOnly), + (ValueBuffer valueBuffer) => valueBuffer[183]); + nullableTimeOnly.SetPropertyIndexes( + index: 183, + originalValueIndex: 183, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnly.TypeMapping = SqliteTimeOnlyTypeMapping.Default; var nullableTimeOnlyArray = runtimeEntityType.AddProperty( @@ -6821,6 +10689,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance) == null); + nullableTimeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeOnlyArray, 184), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[184]); + nullableTimeOnlyArray.SetPropertyIndexes( + index: 184, + originalValueIndex: 184, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -6846,6 +10735,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeSpan(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeSpan(instance).HasValue); + nullableTimeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeSpan, 185), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeSpan), + (ValueBuffer valueBuffer) => valueBuffer[185]); + nullableTimeSpan.SetPropertyIndexes( + index: 185, + originalValueIndex: 185, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpan.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -6867,6 +10777,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance) == null); + nullableTimeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeSpanArray, 186), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[186]); + nullableTimeSpanArray.SetPropertyIndexes( + index: 186, + originalValueIndex: 186, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpanArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -6906,6 +10837,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt16(instance).HasValue); + nullableUInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt16, 187), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt16), + (ValueBuffer valueBuffer) => valueBuffer[187]); + nullableUInt16.SetPropertyIndexes( + index: 187, + originalValueIndex: 187, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -6927,6 +10879,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance) == null); + nullableUInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt16Array, 188), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[188]); + nullableUInt16Array.SetPropertyIndexes( + index: 188, + originalValueIndex: 188, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -6966,6 +10939,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt32(instance).HasValue); + nullableUInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt32, 189), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt32), + (ValueBuffer valueBuffer) => valueBuffer[189]); + nullableUInt32.SetPropertyIndexes( + index: 189, + originalValueIndex: 189, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -6987,6 +10981,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance) == null); + nullableUInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt32Array, 190), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[190]); + nullableUInt32Array.SetPropertyIndexes( + index: 190, + originalValueIndex: 190, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -7026,6 +11041,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt64(instance).HasValue); + nullableUInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt64, 191), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt64), + (ValueBuffer valueBuffer) => valueBuffer[191]); + nullableUInt64.SetPropertyIndexes( + index: 191, + originalValueIndex: 191, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64.TypeMapping = SqliteULongTypeMapping.Default; var nullableUInt64Array = runtimeEntityType.AddProperty( @@ -7033,6 +11069,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance) == null); + nullableUInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt64Array, 192), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[192]); + nullableUInt64Array.SetPropertyIndexes( + index: 192, + originalValueIndex: 192, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -7058,6 +11115,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt8(instance).HasValue); + nullableUInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt8, 193), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt8), + (ValueBuffer valueBuffer) => valueBuffer[193]); + nullableUInt8.SetPropertyIndexes( + index: 193, + originalValueIndex: 193, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -7079,6 +11157,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance) == null); + nullableUInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt8Array, 194), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[194]); + nullableUInt8Array.SetPropertyIndexes( + index: 194, + originalValueIndex: 194, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -7118,6 +11217,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance) == null); + nullableUri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUri, 195), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUri), + (ValueBuffer valueBuffer) => valueBuffer[195]); + nullableUri.SetPropertyIndexes( + index: 195, + originalValueIndex: 195, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUri.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -7145,6 +11265,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance) == null); + nullableUriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUriArray, 196), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUriArray), + (ValueBuffer valueBuffer) => valueBuffer[196]); + nullableUriArray.SetPropertyIndexes( + index: 196, + originalValueIndex: 196, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUriArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -7197,6 +11338,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance) == null); + physicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddress, 197), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[197]); + physicalAddress.SetPropertyIndexes( + index: 197, + originalValueIndex: 197, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7226,6 +11388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance) == null); + physicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressArray, 198), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[198]); + physicalAddressArray.SetPropertyIndexes( + index: 198, + originalValueIndex: 198, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7281,6 +11464,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToBytesConverter()); + physicalAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance) == null); + physicalAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToBytesConverterProperty, 199), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[199]); + physicalAddressToBytesConverterProperty.SetPropertyIndexes( + index: 199, + originalValueIndex: 199, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7291,19 +11495,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (PhysicalAddress v) => v.GetHashCode(), (PhysicalAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 8), converter: new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)), + (byte[] v) => new PhysicalAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)))); + (byte[] v) => new PhysicalAddress(v)))); var physicalAddressToStringConverterProperty = runtimeEntityType.AddProperty( "PhysicalAddressToStringConverterProperty", @@ -7311,6 +11515,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToStringConverter()); + physicalAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance) == null); + physicalAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToStringConverterProperty, 200), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[200]); + physicalAddressToStringConverterProperty.SetPropertyIndexes( + index: 200, + originalValueIndex: 200, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7340,6 +11565,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("String", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @string.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance) == null); + @string.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetAccessors( + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@string, 201), + (InternalEntityEntry entry) => entry.GetCurrentValue(@string), + (ValueBuffer valueBuffer) => valueBuffer[201]); + @string.SetPropertyIndexes( + index: 201, + originalValueIndex: 201, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @string.TypeMapping = SqliteStringTypeMapping.Default; var stringArray = runtimeEntityType.AddProperty( @@ -7347,6 +11593,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance) == null); + stringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetAccessors( + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringArray, 202), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringArray), + (ValueBuffer valueBuffer) => valueBuffer[202]); + stringArray.SetPropertyIndexes( + index: 202, + originalValueIndex: 202, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7372,6 +11639,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBoolConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToBoolConverter()); + stringToBoolConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance) == null); + stringToBoolConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBoolConverterProperty, 203), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBoolConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[203]); + stringToBoolConverterProperty.SetPropertyIndexes( + index: 203, + originalValueIndex: 203, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBoolConverterProperty.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7402,6 +11690,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + stringToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance) == null); + stringToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBytesConverterProperty, 204), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[204]); + stringToBytesConverterProperty.SetPropertyIndexes( + index: 204, + originalValueIndex: 204, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7412,17 +11721,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), converter: new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)), + (byte[] v) => Encoding.UTF32.GetString(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)))); + (byte[] v) => Encoding.UTF32.GetString(v)))); var stringToCharConverterProperty = runtimeEntityType.AddProperty( "StringToCharConverterProperty", @@ -7430,6 +11739,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToCharConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToCharConverter()); + stringToCharConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance) == null); + stringToCharConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToCharConverterProperty, 205), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToCharConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[205]); + stringToCharConverterProperty.SetPropertyIndexes( + index: 205, + originalValueIndex: 205, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToCharConverterProperty.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7461,6 +11791,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateOnlyConverter()); + stringToDateOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance) == null); + stringToDateOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateOnlyConverterProperty, 206), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[206]); + stringToDateOnlyConverterProperty.SetPropertyIndexes( + index: 206, + originalValueIndex: 206, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateOnlyConverterProperty.TypeMapping = SqliteDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7491,6 +11842,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeConverter()); + stringToDateTimeConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance) == null); + stringToDateTimeConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeConverterProperty, 207), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[207]); + stringToDateTimeConverterProperty.SetPropertyIndexes( + index: 207, + originalValueIndex: 207, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeConverterProperty.TypeMapping = SqliteDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7521,6 +11893,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeOffsetConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeOffsetConverter()); + stringToDateTimeOffsetConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance) == null); + stringToDateTimeOffsetConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeOffsetConverterProperty, 208), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeOffsetConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[208]); + stringToDateTimeOffsetConverterProperty.SetPropertyIndexes( + index: 208, + originalValueIndex: 208, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeOffsetConverterProperty.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7551,6 +11944,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDecimalNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDecimalNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance) == null); + stringToDecimalNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDecimalNumberConverterProperty, 209), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDecimalNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[209]); + stringToDecimalNumberConverterProperty.SetPropertyIndexes( + index: 209, + originalValueIndex: 209, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDecimalNumberConverterProperty.TypeMapping = SqliteDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7581,6 +11995,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDoubleNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDoubleNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance) == null); + stringToDoubleNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDoubleNumberConverterProperty, 210), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDoubleNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[210]); + stringToDoubleNumberConverterProperty.SetPropertyIndexes( + index: 210, + originalValueIndex: 210, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDoubleNumberConverterProperty.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7612,6 +12047,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToEnumConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToEnumConverter()); + stringToEnumConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance) == null); + stringToEnumConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToEnumConverterProperty, 211), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToEnumConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[211]); + stringToEnumConverterProperty.SetPropertyIndexes( + index: 211, + originalValueIndex: 211, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToEnumConverterProperty.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7641,6 +12097,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToGuidConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringToGuidConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance) == null); + stringToGuidConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToGuidConverterProperty, 212), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToGuidConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[212]); + stringToGuidConverterProperty.SetPropertyIndexes( + index: 212, + originalValueIndex: 212, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToGuidConverterProperty.TypeMapping = SqliteStringTypeMapping.Default; var stringToIntNumberConverterProperty = runtimeEntityType.AddProperty( @@ -7649,6 +12126,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToIntNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToIntNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance) == null); + stringToIntNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToIntNumberConverterProperty, 213), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToIntNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[213]); + stringToIntNumberConverterProperty.SetPropertyIndexes( + index: 213, + originalValueIndex: 213, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToIntNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7680,6 +12178,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeOnlyConverter()); + stringToTimeOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance) == null); + stringToTimeOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeOnlyConverterProperty, 214), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[214]); + stringToTimeOnlyConverterProperty.SetPropertyIndexes( + index: 214, + originalValueIndex: 214, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeOnlyConverterProperty.TypeMapping = SqliteTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7710,6 +12229,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeSpanConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeSpanConverter()); + stringToTimeSpanConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance) == null); + stringToTimeSpanConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeSpanConverterProperty, 215), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeSpanConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[215]); + stringToTimeSpanConverterProperty.SetPropertyIndexes( + index: 215, + originalValueIndex: 215, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeSpanConverterProperty.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7741,6 +12281,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToUriConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToUriConverter()); + stringToUriConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance) == null); + stringToUriConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToUriConverterProperty, 216), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToUriConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[216]); + stringToUriConverterProperty.SetPropertyIndexes( + index: 216, + originalValueIndex: 216, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToUriConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7769,6 +12330,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeOnly(0, 0, 0)); + timeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance) == default(TimeOnly)); + timeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnly, 217), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnly), + (ValueBuffer valueBuffer) => valueBuffer[217]); + timeOnly.SetPropertyIndexes( + index: 217, + originalValueIndex: 217, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnly.TypeMapping = SqliteTimeOnlyTypeMapping.Default; var timeOnlyArray = runtimeEntityType.AddProperty( @@ -7776,6 +12358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance) == null); + timeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyArray, 218), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[218]); + timeOnlyArray.SetPropertyIndexes( + index: 218, + originalValueIndex: 218, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7801,6 +12404,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToStringConverter()); + timeOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance) == default(TimeOnly)); + timeOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToStringConverterProperty, 219), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[219]); + timeOnlyToStringConverterProperty.SetPropertyIndexes( + index: 219, + originalValueIndex: 219, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7832,6 +12456,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToTicksConverter()); + timeOnlyToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance) == default(TimeOnly)); + timeOnlyToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToTicksConverterProperty, 220), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[220]); + timeOnlyToTicksConverterProperty.SetPropertyIndexes( + index: 220, + originalValueIndex: 220, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToTicksConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7863,6 +12508,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeSpan(0, 0, 0, 0, 0)); + timeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance) == default(TimeSpan)); + timeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpan, 221), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpan), + (ValueBuffer valueBuffer) => valueBuffer[221]); + timeSpan.SetPropertyIndexes( + index: 221, + originalValueIndex: 221, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpan.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7884,6 +12550,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance) == null); + timeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanArray, 222), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[222]); + timeSpanArray.SetPropertyIndexes( + index: 222, + originalValueIndex: 222, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7923,6 +12610,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToStringConverter()); + timeSpanToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance) == default(TimeSpan)); + timeSpanToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToStringConverterProperty, 223), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[223]); + timeSpanToStringConverterProperty.SetPropertyIndexes( + index: 223, + originalValueIndex: 223, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7954,6 +12662,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToTicksConverter()); + timeSpanToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance) == default(TimeSpan)); + timeSpanToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToTicksConverterProperty, 224), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[224]); + timeSpanToTicksConverterProperty.SetPropertyIndexes( + index: 224, + originalValueIndex: 224, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToTicksConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7985,6 +12714,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (ushort)0); + uInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance) == 0); + uInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16, 225), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16), + (ValueBuffer valueBuffer) => valueBuffer[225]); + uInt16.SetPropertyIndexes( + index: 225, + originalValueIndex: 225, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -8006,6 +12756,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance) == null); + uInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16Array, 226), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[226]); + uInt16Array.SetPropertyIndexes( + index: 226, + originalValueIndex: 226, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -8045,6 +12816,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0u); + uInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity) == 0U, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance) == 0U); + uInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32, 227), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32), + (ValueBuffer valueBuffer) => valueBuffer[227]); + uInt32.SetPropertyIndexes( + index: 227, + originalValueIndex: 227, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -8066,6 +12858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance) == null); + uInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32Array, 228), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[228]); + uInt32Array.SetPropertyIndexes( + index: 228, + originalValueIndex: 228, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -8105,6 +12918,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0ul); + uInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity) == 0UL, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance) == 0UL); + uInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64, 229), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64), + (ValueBuffer valueBuffer) => valueBuffer[229]); + uInt64.SetPropertyIndexes( + index: 229, + originalValueIndex: 229, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64.TypeMapping = SqliteULongTypeMapping.Default; var uInt64Array = runtimeEntityType.AddProperty( @@ -8112,6 +12946,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance) == null); + uInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64Array, 230), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[230]); + uInt64Array.SetPropertyIndexes( + index: 230, + originalValueIndex: 230, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -8137,6 +12992,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (byte)0); + uInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance) == 0); + uInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8, 231), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8), + (ValueBuffer valueBuffer) => valueBuffer[231]); + uInt8.SetPropertyIndexes( + index: 231, + originalValueIndex: 231, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -8158,25 +13034,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance) == null); + uInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8Array, 232), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[232]); + uInt8Array.SetPropertyIndexes( + index: 232, + originalValueIndex: 232, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8Array.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var uri = runtimeEntityType.AddProperty( "Uri", typeof(Uri), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Uri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance) == null); + uri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetAccessors( + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uri, 233), + (InternalEntityEntry entry) => entry.GetCurrentValue(uri), + (ValueBuffer valueBuffer) => valueBuffer[233]); + uri.SetPropertyIndexes( + index: 233, + originalValueIndex: 233, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uri.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8204,6 +13122,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance) == null); + uriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetAccessors( + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriArray, 234), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriArray), + (ValueBuffer valueBuffer) => valueBuffer[234]); + uriArray.SetPropertyIndexes( + index: 234, + originalValueIndex: 234, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8257,6 +13196,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new UriToStringConverter()); + uriToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance) == null); + uriToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriToStringConverterProperty, 235), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[235]); + uriToStringConverterProperty.SetPropertyIndexes( + index: 235, + originalValueIndex: 235, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8288,6 +13248,284 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var @bool = runtimeEntityType.FindProperty("Bool")!; + var boolArray = runtimeEntityType.FindProperty("BoolArray")!; + var boolToStringConverterProperty = runtimeEntityType.FindProperty("BoolToStringConverterProperty")!; + var boolToTwoValuesConverterProperty = runtimeEntityType.FindProperty("BoolToTwoValuesConverterProperty")!; + var boolToZeroOneConverterProperty = runtimeEntityType.FindProperty("BoolToZeroOneConverterProperty")!; + var bytes = runtimeEntityType.FindProperty("Bytes")!; + var bytesArray = runtimeEntityType.FindProperty("BytesArray")!; + var bytesToStringConverterProperty = runtimeEntityType.FindProperty("BytesToStringConverterProperty")!; + var castingConverterProperty = runtimeEntityType.FindProperty("CastingConverterProperty")!; + var @char = runtimeEntityType.FindProperty("Char")!; + var charArray = runtimeEntityType.FindProperty("CharArray")!; + var charToStringConverterProperty = runtimeEntityType.FindProperty("CharToStringConverterProperty")!; + var dateOnly = runtimeEntityType.FindProperty("DateOnly")!; + var dateOnlyArray = runtimeEntityType.FindProperty("DateOnlyArray")!; + var dateOnlyToStringConverterProperty = runtimeEntityType.FindProperty("DateOnlyToStringConverterProperty")!; + var dateTime = runtimeEntityType.FindProperty("DateTime")!; + var dateTimeArray = runtimeEntityType.FindProperty("DateTimeArray")!; + var dateTimeOffsetToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBinaryConverterProperty")!; + var dateTimeOffsetToBytesConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBytesConverterProperty")!; + var dateTimeOffsetToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToStringConverterProperty")!; + var dateTimeToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeToBinaryConverterProperty")!; + var dateTimeToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeToStringConverterProperty")!; + var dateTimeToTicksConverterProperty = runtimeEntityType.FindProperty("DateTimeToTicksConverterProperty")!; + var @decimal = runtimeEntityType.FindProperty("Decimal")!; + var decimalArray = runtimeEntityType.FindProperty("DecimalArray")!; + var decimalNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToBytesConverterProperty")!; + var decimalNumberToStringConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToStringConverterProperty")!; + var @double = runtimeEntityType.FindProperty("Double")!; + var doubleArray = runtimeEntityType.FindProperty("DoubleArray")!; + var doubleNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToBytesConverterProperty")!; + var doubleNumberToStringConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToStringConverterProperty")!; + var enum16 = runtimeEntityType.FindProperty("Enum16")!; + var enum16Array = runtimeEntityType.FindProperty("Enum16Array")!; + var enum16AsString = runtimeEntityType.FindProperty("Enum16AsString")!; + var enum16AsStringArray = runtimeEntityType.FindProperty("Enum16AsStringArray")!; + var enum16AsStringCollection = runtimeEntityType.FindProperty("Enum16AsStringCollection")!; + var enum16Collection = runtimeEntityType.FindProperty("Enum16Collection")!; + var enum32 = runtimeEntityType.FindProperty("Enum32")!; + var enum32Array = runtimeEntityType.FindProperty("Enum32Array")!; + var enum32AsString = runtimeEntityType.FindProperty("Enum32AsString")!; + var enum32AsStringArray = runtimeEntityType.FindProperty("Enum32AsStringArray")!; + var enum32AsStringCollection = runtimeEntityType.FindProperty("Enum32AsStringCollection")!; + var enum32Collection = runtimeEntityType.FindProperty("Enum32Collection")!; + var enum64 = runtimeEntityType.FindProperty("Enum64")!; + var enum64Array = runtimeEntityType.FindProperty("Enum64Array")!; + var enum64AsString = runtimeEntityType.FindProperty("Enum64AsString")!; + var enum64AsStringArray = runtimeEntityType.FindProperty("Enum64AsStringArray")!; + var enum64AsStringCollection = runtimeEntityType.FindProperty("Enum64AsStringCollection")!; + var enum64Collection = runtimeEntityType.FindProperty("Enum64Collection")!; + var enum8 = runtimeEntityType.FindProperty("Enum8")!; + var enum8Array = runtimeEntityType.FindProperty("Enum8Array")!; + var enum8AsString = runtimeEntityType.FindProperty("Enum8AsString")!; + var enum8AsStringArray = runtimeEntityType.FindProperty("Enum8AsStringArray")!; + var enum8AsStringCollection = runtimeEntityType.FindProperty("Enum8AsStringCollection")!; + var enum8Collection = runtimeEntityType.FindProperty("Enum8Collection")!; + var enumToNumberConverterProperty = runtimeEntityType.FindProperty("EnumToNumberConverterProperty")!; + var enumToStringConverterProperty = runtimeEntityType.FindProperty("EnumToStringConverterProperty")!; + var enumU16 = runtimeEntityType.FindProperty("EnumU16")!; + var enumU16Array = runtimeEntityType.FindProperty("EnumU16Array")!; + var enumU16AsString = runtimeEntityType.FindProperty("EnumU16AsString")!; + var enumU16AsStringArray = runtimeEntityType.FindProperty("EnumU16AsStringArray")!; + var enumU16AsStringCollection = runtimeEntityType.FindProperty("EnumU16AsStringCollection")!; + var enumU16Collection = runtimeEntityType.FindProperty("EnumU16Collection")!; + var enumU32 = runtimeEntityType.FindProperty("EnumU32")!; + var enumU32Array = runtimeEntityType.FindProperty("EnumU32Array")!; + var enumU32AsString = runtimeEntityType.FindProperty("EnumU32AsString")!; + var enumU32AsStringArray = runtimeEntityType.FindProperty("EnumU32AsStringArray")!; + var enumU32AsStringCollection = runtimeEntityType.FindProperty("EnumU32AsStringCollection")!; + var enumU32Collection = runtimeEntityType.FindProperty("EnumU32Collection")!; + var enumU64 = runtimeEntityType.FindProperty("EnumU64")!; + var enumU64Array = runtimeEntityType.FindProperty("EnumU64Array")!; + var enumU64AsString = runtimeEntityType.FindProperty("EnumU64AsString")!; + var enumU64AsStringArray = runtimeEntityType.FindProperty("EnumU64AsStringArray")!; + var enumU64AsStringCollection = runtimeEntityType.FindProperty("EnumU64AsStringCollection")!; + var enumU64Collection = runtimeEntityType.FindProperty("EnumU64Collection")!; + var enumU8 = runtimeEntityType.FindProperty("EnumU8")!; + var enumU8Array = runtimeEntityType.FindProperty("EnumU8Array")!; + var enumU8AsString = runtimeEntityType.FindProperty("EnumU8AsString")!; + var enumU8AsStringArray = runtimeEntityType.FindProperty("EnumU8AsStringArray")!; + var enumU8AsStringCollection = runtimeEntityType.FindProperty("EnumU8AsStringCollection")!; + var enumU8Collection = runtimeEntityType.FindProperty("EnumU8Collection")!; + var @float = runtimeEntityType.FindProperty("Float")!; + var floatArray = runtimeEntityType.FindProperty("FloatArray")!; + var guid = runtimeEntityType.FindProperty("Guid")!; + var guidArray = runtimeEntityType.FindProperty("GuidArray")!; + var guidToBytesConverterProperty = runtimeEntityType.FindProperty("GuidToBytesConverterProperty")!; + var guidToStringConverterProperty = runtimeEntityType.FindProperty("GuidToStringConverterProperty")!; + var iPAddress = runtimeEntityType.FindProperty("IPAddress")!; + var iPAddressArray = runtimeEntityType.FindProperty("IPAddressArray")!; + var iPAddressToBytesConverterProperty = runtimeEntityType.FindProperty("IPAddressToBytesConverterProperty")!; + var iPAddressToStringConverterProperty = runtimeEntityType.FindProperty("IPAddressToStringConverterProperty")!; + var int16 = runtimeEntityType.FindProperty("Int16")!; + var int16Array = runtimeEntityType.FindProperty("Int16Array")!; + var int32 = runtimeEntityType.FindProperty("Int32")!; + var int32Array = runtimeEntityType.FindProperty("Int32Array")!; + var int64 = runtimeEntityType.FindProperty("Int64")!; + var int64Array = runtimeEntityType.FindProperty("Int64Array")!; + var int8 = runtimeEntityType.FindProperty("Int8")!; + var int8Array = runtimeEntityType.FindProperty("Int8Array")!; + var intNumberToBytesConverterProperty = runtimeEntityType.FindProperty("IntNumberToBytesConverterProperty")!; + var intNumberToStringConverterProperty = runtimeEntityType.FindProperty("IntNumberToStringConverterProperty")!; + var nullIntToNullStringConverterProperty = runtimeEntityType.FindProperty("NullIntToNullStringConverterProperty")!; + var nullableBool = runtimeEntityType.FindProperty("NullableBool")!; + var nullableBoolArray = runtimeEntityType.FindProperty("NullableBoolArray")!; + var nullableBytes = runtimeEntityType.FindProperty("NullableBytes")!; + var nullableBytesArray = runtimeEntityType.FindProperty("NullableBytesArray")!; + var nullableChar = runtimeEntityType.FindProperty("NullableChar")!; + var nullableCharArray = runtimeEntityType.FindProperty("NullableCharArray")!; + var nullableDateOnly = runtimeEntityType.FindProperty("NullableDateOnly")!; + var nullableDateOnlyArray = runtimeEntityType.FindProperty("NullableDateOnlyArray")!; + var nullableDateTime = runtimeEntityType.FindProperty("NullableDateTime")!; + var nullableDateTimeArray = runtimeEntityType.FindProperty("NullableDateTimeArray")!; + var nullableDecimal = runtimeEntityType.FindProperty("NullableDecimal")!; + var nullableDecimalArray = runtimeEntityType.FindProperty("NullableDecimalArray")!; + var nullableDouble = runtimeEntityType.FindProperty("NullableDouble")!; + var nullableDoubleArray = runtimeEntityType.FindProperty("NullableDoubleArray")!; + var nullableEnum16 = runtimeEntityType.FindProperty("NullableEnum16")!; + var nullableEnum16Array = runtimeEntityType.FindProperty("NullableEnum16Array")!; + var nullableEnum16AsString = runtimeEntityType.FindProperty("NullableEnum16AsString")!; + var nullableEnum16AsStringArray = runtimeEntityType.FindProperty("NullableEnum16AsStringArray")!; + var nullableEnum16AsStringCollection = runtimeEntityType.FindProperty("NullableEnum16AsStringCollection")!; + var nullableEnum16Collection = runtimeEntityType.FindProperty("NullableEnum16Collection")!; + var nullableEnum32 = runtimeEntityType.FindProperty("NullableEnum32")!; + var nullableEnum32Array = runtimeEntityType.FindProperty("NullableEnum32Array")!; + var nullableEnum32AsString = runtimeEntityType.FindProperty("NullableEnum32AsString")!; + var nullableEnum32AsStringArray = runtimeEntityType.FindProperty("NullableEnum32AsStringArray")!; + var nullableEnum32AsStringCollection = runtimeEntityType.FindProperty("NullableEnum32AsStringCollection")!; + var nullableEnum32Collection = runtimeEntityType.FindProperty("NullableEnum32Collection")!; + var nullableEnum64 = runtimeEntityType.FindProperty("NullableEnum64")!; + var nullableEnum64Array = runtimeEntityType.FindProperty("NullableEnum64Array")!; + var nullableEnum64AsString = runtimeEntityType.FindProperty("NullableEnum64AsString")!; + var nullableEnum64AsStringArray = runtimeEntityType.FindProperty("NullableEnum64AsStringArray")!; + var nullableEnum64AsStringCollection = runtimeEntityType.FindProperty("NullableEnum64AsStringCollection")!; + var nullableEnum64Collection = runtimeEntityType.FindProperty("NullableEnum64Collection")!; + var nullableEnum8 = runtimeEntityType.FindProperty("NullableEnum8")!; + var nullableEnum8Array = runtimeEntityType.FindProperty("NullableEnum8Array")!; + var nullableEnum8AsString = runtimeEntityType.FindProperty("NullableEnum8AsString")!; + var nullableEnum8AsStringArray = runtimeEntityType.FindProperty("NullableEnum8AsStringArray")!; + var nullableEnum8AsStringCollection = runtimeEntityType.FindProperty("NullableEnum8AsStringCollection")!; + var nullableEnum8Collection = runtimeEntityType.FindProperty("NullableEnum8Collection")!; + var nullableEnumU16 = runtimeEntityType.FindProperty("NullableEnumU16")!; + var nullableEnumU16Array = runtimeEntityType.FindProperty("NullableEnumU16Array")!; + var nullableEnumU16AsString = runtimeEntityType.FindProperty("NullableEnumU16AsString")!; + var nullableEnumU16AsStringArray = runtimeEntityType.FindProperty("NullableEnumU16AsStringArray")!; + var nullableEnumU16AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU16AsStringCollection")!; + var nullableEnumU16Collection = runtimeEntityType.FindProperty("NullableEnumU16Collection")!; + var nullableEnumU32 = runtimeEntityType.FindProperty("NullableEnumU32")!; + var nullableEnumU32Array = runtimeEntityType.FindProperty("NullableEnumU32Array")!; + var nullableEnumU32AsString = runtimeEntityType.FindProperty("NullableEnumU32AsString")!; + var nullableEnumU32AsStringArray = runtimeEntityType.FindProperty("NullableEnumU32AsStringArray")!; + var nullableEnumU32AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU32AsStringCollection")!; + var nullableEnumU32Collection = runtimeEntityType.FindProperty("NullableEnumU32Collection")!; + var nullableEnumU64 = runtimeEntityType.FindProperty("NullableEnumU64")!; + var nullableEnumU64Array = runtimeEntityType.FindProperty("NullableEnumU64Array")!; + var nullableEnumU64AsString = runtimeEntityType.FindProperty("NullableEnumU64AsString")!; + var nullableEnumU64AsStringArray = runtimeEntityType.FindProperty("NullableEnumU64AsStringArray")!; + var nullableEnumU64AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU64AsStringCollection")!; + var nullableEnumU64Collection = runtimeEntityType.FindProperty("NullableEnumU64Collection")!; + var nullableEnumU8 = runtimeEntityType.FindProperty("NullableEnumU8")!; + var nullableEnumU8Array = runtimeEntityType.FindProperty("NullableEnumU8Array")!; + var nullableEnumU8AsString = runtimeEntityType.FindProperty("NullableEnumU8AsString")!; + var nullableEnumU8AsStringArray = runtimeEntityType.FindProperty("NullableEnumU8AsStringArray")!; + var nullableEnumU8AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU8AsStringCollection")!; + var nullableEnumU8Collection = runtimeEntityType.FindProperty("NullableEnumU8Collection")!; + var nullableFloat = runtimeEntityType.FindProperty("NullableFloat")!; + var nullableFloatArray = runtimeEntityType.FindProperty("NullableFloatArray")!; + var nullableGuid = runtimeEntityType.FindProperty("NullableGuid")!; + var nullableGuidArray = runtimeEntityType.FindProperty("NullableGuidArray")!; + var nullableIPAddress = runtimeEntityType.FindProperty("NullableIPAddress")!; + var nullableIPAddressArray = runtimeEntityType.FindProperty("NullableIPAddressArray")!; + var nullableInt16 = runtimeEntityType.FindProperty("NullableInt16")!; + var nullableInt16Array = runtimeEntityType.FindProperty("NullableInt16Array")!; + var nullableInt32 = runtimeEntityType.FindProperty("NullableInt32")!; + var nullableInt32Array = runtimeEntityType.FindProperty("NullableInt32Array")!; + var nullableInt64 = runtimeEntityType.FindProperty("NullableInt64")!; + var nullableInt64Array = runtimeEntityType.FindProperty("NullableInt64Array")!; + var nullableInt8 = runtimeEntityType.FindProperty("NullableInt8")!; + var nullableInt8Array = runtimeEntityType.FindProperty("NullableInt8Array")!; + var nullablePhysicalAddress = runtimeEntityType.FindProperty("NullablePhysicalAddress")!; + var nullablePhysicalAddressArray = runtimeEntityType.FindProperty("NullablePhysicalAddressArray")!; + var nullableString = runtimeEntityType.FindProperty("NullableString")!; + var nullableStringArray = runtimeEntityType.FindProperty("NullableStringArray")!; + var nullableTimeOnly = runtimeEntityType.FindProperty("NullableTimeOnly")!; + var nullableTimeOnlyArray = runtimeEntityType.FindProperty("NullableTimeOnlyArray")!; + var nullableTimeSpan = runtimeEntityType.FindProperty("NullableTimeSpan")!; + var nullableTimeSpanArray = runtimeEntityType.FindProperty("NullableTimeSpanArray")!; + var nullableUInt16 = runtimeEntityType.FindProperty("NullableUInt16")!; + var nullableUInt16Array = runtimeEntityType.FindProperty("NullableUInt16Array")!; + var nullableUInt32 = runtimeEntityType.FindProperty("NullableUInt32")!; + var nullableUInt32Array = runtimeEntityType.FindProperty("NullableUInt32Array")!; + var nullableUInt64 = runtimeEntityType.FindProperty("NullableUInt64")!; + var nullableUInt64Array = runtimeEntityType.FindProperty("NullableUInt64Array")!; + var nullableUInt8 = runtimeEntityType.FindProperty("NullableUInt8")!; + var nullableUInt8Array = runtimeEntityType.FindProperty("NullableUInt8Array")!; + var nullableUri = runtimeEntityType.FindProperty("NullableUri")!; + var nullableUriArray = runtimeEntityType.FindProperty("NullableUriArray")!; + var physicalAddress = runtimeEntityType.FindProperty("PhysicalAddress")!; + var physicalAddressArray = runtimeEntityType.FindProperty("PhysicalAddressArray")!; + var physicalAddressToBytesConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToBytesConverterProperty")!; + var physicalAddressToStringConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToStringConverterProperty")!; + var @string = runtimeEntityType.FindProperty("String")!; + var stringArray = runtimeEntityType.FindProperty("StringArray")!; + var stringToBoolConverterProperty = runtimeEntityType.FindProperty("StringToBoolConverterProperty")!; + var stringToBytesConverterProperty = runtimeEntityType.FindProperty("StringToBytesConverterProperty")!; + var stringToCharConverterProperty = runtimeEntityType.FindProperty("StringToCharConverterProperty")!; + var stringToDateOnlyConverterProperty = runtimeEntityType.FindProperty("StringToDateOnlyConverterProperty")!; + var stringToDateTimeConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeConverterProperty")!; + var stringToDateTimeOffsetConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeOffsetConverterProperty")!; + var stringToDecimalNumberConverterProperty = runtimeEntityType.FindProperty("StringToDecimalNumberConverterProperty")!; + var stringToDoubleNumberConverterProperty = runtimeEntityType.FindProperty("StringToDoubleNumberConverterProperty")!; + var stringToEnumConverterProperty = runtimeEntityType.FindProperty("StringToEnumConverterProperty")!; + var stringToGuidConverterProperty = runtimeEntityType.FindProperty("StringToGuidConverterProperty")!; + var stringToIntNumberConverterProperty = runtimeEntityType.FindProperty("StringToIntNumberConverterProperty")!; + var stringToTimeOnlyConverterProperty = runtimeEntityType.FindProperty("StringToTimeOnlyConverterProperty")!; + var stringToTimeSpanConverterProperty = runtimeEntityType.FindProperty("StringToTimeSpanConverterProperty")!; + var stringToUriConverterProperty = runtimeEntityType.FindProperty("StringToUriConverterProperty")!; + var timeOnly = runtimeEntityType.FindProperty("TimeOnly")!; + var timeOnlyArray = runtimeEntityType.FindProperty("TimeOnlyArray")!; + var timeOnlyToStringConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToStringConverterProperty")!; + var timeOnlyToTicksConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToTicksConverterProperty")!; + var timeSpan = runtimeEntityType.FindProperty("TimeSpan")!; + var timeSpanArray = runtimeEntityType.FindProperty("TimeSpanArray")!; + var timeSpanToStringConverterProperty = runtimeEntityType.FindProperty("TimeSpanToStringConverterProperty")!; + var timeSpanToTicksConverterProperty = runtimeEntityType.FindProperty("TimeSpanToTicksConverterProperty")!; + var uInt16 = runtimeEntityType.FindProperty("UInt16")!; + var uInt16Array = runtimeEntityType.FindProperty("UInt16Array")!; + var uInt32 = runtimeEntityType.FindProperty("UInt32")!; + var uInt32Array = runtimeEntityType.FindProperty("UInt32Array")!; + var uInt64 = runtimeEntityType.FindProperty("UInt64")!; + var uInt64Array = runtimeEntityType.FindProperty("UInt64Array")!; + var uInt8 = runtimeEntityType.FindProperty("UInt8")!; + var uInt8Array = runtimeEntityType.FindProperty("UInt8Array")!; + var uri = runtimeEntityType.FindProperty("Uri")!; + var uriArray = runtimeEntityType.FindProperty("UriArray")!; + var uriToStringConverterProperty = runtimeEntityType.FindProperty("UriToStringConverterProperty")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg = (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)@bool.GetValueComparer()).Snapshot(source.GetCurrentValue(@bool)), (IEnumerable)source.GetCurrentValue(boolArray) == null ? null : (bool[])((ValueComparer>)boolArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(boolArray)), ((ValueComparer)boolToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToStringConverterProperty)), ((ValueComparer)boolToTwoValuesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToTwoValuesConverterProperty)), ((ValueComparer)boolToZeroOneConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToZeroOneConverterProperty)), source.GetCurrentValue(bytes) == null ? null : ((ValueComparer)bytes.GetValueComparer()).Snapshot(source.GetCurrentValue(bytes)), (IEnumerable)source.GetCurrentValue(bytesArray) == null ? null : (byte[][])((ValueComparer>)bytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(bytesArray)), source.GetCurrentValue(bytesToStringConverterProperty) == null ? null : ((ValueComparer)bytesToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(bytesToStringConverterProperty)), ((ValueComparer)castingConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(castingConverterProperty)), ((ValueComparer)@char.GetValueComparer()).Snapshot(source.GetCurrentValue(@char)), (IEnumerable)source.GetCurrentValue(charArray) == null ? null : (char[])((ValueComparer>)charArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(charArray)), ((ValueComparer)charToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(charToStringConverterProperty)), ((ValueComparer)dateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnly)), (IEnumerable)source.GetCurrentValue(dateOnlyArray) == null ? null : (DateOnly[])((ValueComparer>)dateOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateOnlyArray)), ((ValueComparer)dateOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnlyToStringConverterProperty)), ((ValueComparer)dateTime.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTime)), (IEnumerable)source.GetCurrentValue(dateTimeArray) == null ? null : (DateTime[])((ValueComparer>)dateTimeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateTimeArray)), ((ValueComparer)dateTimeOffsetToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty)), ((ValueComparer)dateTimeOffsetToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBytesConverterProperty)), ((ValueComparer)dateTimeOffsetToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToStringConverterProperty)), ((ValueComparer)dateTimeToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToBinaryConverterProperty)), ((ValueComparer)dateTimeToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToStringConverterProperty)), ((ValueComparer)dateTimeToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToTicksConverterProperty)), ((ValueComparer)@decimal.GetValueComparer()).Snapshot(source.GetCurrentValue(@decimal)), (IEnumerable)source.GetCurrentValue(decimalArray) == null ? null : (decimal[])((ValueComparer>)decimalArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(decimalArray)), ((ValueComparer)decimalNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToBytesConverterProperty)), ((ValueComparer)decimalNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToStringConverterProperty)), ((ValueComparer)@double.GetValueComparer()).Snapshot(source.GetCurrentValue(@double)), (IEnumerable)source.GetCurrentValue(doubleArray) == null ? null : (double[])((ValueComparer>)doubleArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(doubleArray))); + var entity0 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], List, List, CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], List, List, CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], List, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32, CompiledModelTestBase.EnumU16, CompiledModelTestBase.EnumU16[]>(((ValueComparer)doubleNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToBytesConverterProperty)), ((ValueComparer)doubleNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToStringConverterProperty)), ((ValueComparer)enum16.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16)), (IEnumerable)source.GetCurrentValue(enum16Array) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16Array)), ((ValueComparer)enum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16AsString)), (IEnumerable)source.GetCurrentValue(enum16AsStringArray) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum16AsStringCollection) == null ? null : (List)((ValueComparer>)enum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum16Collection) == null ? null : (List)((ValueComparer>)enum16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16Collection)), ((ValueComparer)enum32.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32)), (IEnumerable)source.GetCurrentValue(enum32Array) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32Array)), ((ValueComparer)enum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32AsString)), (IEnumerable)source.GetCurrentValue(enum32AsStringArray) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum32AsStringCollection) == null ? null : (List)((ValueComparer>)enum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum32Collection) == null ? null : (List)((ValueComparer>)enum32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32Collection)), ((ValueComparer)enum64.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64)), (IEnumerable)source.GetCurrentValue(enum64Array) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64Array)), ((ValueComparer)enum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64AsString)), (IEnumerable)source.GetCurrentValue(enum64AsStringArray) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum64AsStringCollection) == null ? null : (List)((ValueComparer>)enum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum64Collection) == null ? null : (List)((ValueComparer>)enum64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64Collection)), ((ValueComparer)enum8.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8)), (IEnumerable)source.GetCurrentValue(enum8Array) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8Array)), ((ValueComparer)enum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8AsString)), (IEnumerable)source.GetCurrentValue(enum8AsStringArray) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum8AsStringCollection) == null ? null : (List)((ValueComparer>)enum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum8Collection) == null ? null : (List)((ValueComparer>)enum8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8Collection)), ((ValueComparer)enumToNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToNumberConverterProperty)), ((ValueComparer)enumToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToStringConverterProperty)), ((ValueComparer)enumU16.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16)), (IEnumerable)source.GetCurrentValue(enumU16Array) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16Array))); + var entity1 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg1 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], List, List, CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], List, List, CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], List, List, float, float[], Guid, Guid[], Guid, Guid, IPAddress, IPAddress[]>(((ValueComparer)enumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16AsString)), (IEnumerable)source.GetCurrentValue(enumU16AsStringArray) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection) == null ? null : (List)((ValueComparer>)enumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU16Collection) == null ? null : (List)((ValueComparer>)enumU16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16Collection)), ((ValueComparer)enumU32.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32)), (IEnumerable)source.GetCurrentValue(enumU32Array) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32Array)), ((ValueComparer)enumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32AsString)), (IEnumerable)source.GetCurrentValue(enumU32AsStringArray) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection) == null ? null : (List)((ValueComparer>)enumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU32Collection) == null ? null : (List)((ValueComparer>)enumU32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32Collection)), ((ValueComparer)enumU64.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64)), (IEnumerable)source.GetCurrentValue(enumU64Array) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64Array)), ((ValueComparer)enumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64AsString)), (IEnumerable)source.GetCurrentValue(enumU64AsStringArray) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection) == null ? null : (List)((ValueComparer>)enumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU64Collection) == null ? null : (List)((ValueComparer>)enumU64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64Collection)), ((ValueComparer)enumU8.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8)), (IEnumerable)source.GetCurrentValue(enumU8Array) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8Array)), ((ValueComparer)enumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8AsString)), (IEnumerable)source.GetCurrentValue(enumU8AsStringArray) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection) == null ? null : (List)((ValueComparer>)enumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU8Collection) == null ? null : (List)((ValueComparer>)enumU8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8Collection)), ((ValueComparer)@float.GetValueComparer()).Snapshot(source.GetCurrentValue(@float)), (IEnumerable)source.GetCurrentValue(floatArray) == null ? null : (float[])((ValueComparer>)floatArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(floatArray)), ((ValueComparer)guid.GetValueComparer()).Snapshot(source.GetCurrentValue(guid)), (IEnumerable)source.GetCurrentValue(guidArray) == null ? null : (Guid[])((ValueComparer>)guidArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(guidArray)), ((ValueComparer)guidToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToBytesConverterProperty)), ((ValueComparer)guidToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToStringConverterProperty)), source.GetCurrentValue(iPAddress) == null ? null : ((ValueComparer)iPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddress)), (IEnumerable)source.GetCurrentValue(iPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)iPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(iPAddressArray))); + var entity2 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg2 = (ISnapshot)new Snapshot, Nullable, Nullable[], byte[], byte[][], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable>(source.GetCurrentValue(iPAddressToBytesConverterProperty) == null ? null : ((ValueComparer)iPAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToBytesConverterProperty)), source.GetCurrentValue(iPAddressToStringConverterProperty) == null ? null : ((ValueComparer)iPAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToStringConverterProperty)), ((ValueComparer)int16.GetValueComparer()).Snapshot(source.GetCurrentValue(int16)), (IEnumerable)source.GetCurrentValue(int16Array) == null ? null : (short[])((ValueComparer>)int16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int16Array)), ((ValueComparer)int32.GetValueComparer()).Snapshot(source.GetCurrentValue(int32)), (IEnumerable)source.GetCurrentValue(int32Array) == null ? null : (int[])((ValueComparer>)int32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int32Array)), ((ValueComparer)int64.GetValueComparer()).Snapshot(source.GetCurrentValue(int64)), (IEnumerable)source.GetCurrentValue(int64Array) == null ? null : (long[])((ValueComparer>)int64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int64Array)), ((ValueComparer)int8.GetValueComparer()).Snapshot(source.GetCurrentValue(int8)), (IEnumerable)source.GetCurrentValue(int8Array) == null ? null : (sbyte[])((ValueComparer>)int8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int8Array)), ((ValueComparer)intNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToBytesConverterProperty)), ((ValueComparer)intNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToStringConverterProperty)), source.GetCurrentValue>(nullIntToNullStringConverterProperty) == null ? null : ((ValueComparer>)nullIntToNullStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullIntToNullStringConverterProperty)), source.GetCurrentValue>(nullableBool) == null ? null : ((ValueComparer>)nullableBool.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableBool)), (IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray) == null ? null : (Nullable[])((ValueComparer>>)nullableBoolArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray)), source.GetCurrentValue(nullableBytes) == null ? null : ((ValueComparer)nullableBytes.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableBytes)), (IEnumerable)source.GetCurrentValue(nullableBytesArray) == null ? null : (byte[][])((ValueComparer>)nullableBytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableBytesArray)), source.GetCurrentValue>(nullableChar) == null ? null : ((ValueComparer>)nullableChar.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableChar)), (IEnumerable>)source.GetCurrentValue[]>(nullableCharArray) == null ? null : (Nullable[])((ValueComparer>>)nullableCharArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableCharArray)), source.GetCurrentValue>(nullableDateOnly) == null ? null : ((ValueComparer>)nullableDateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray)), source.GetCurrentValue>(nullableDateTime) == null ? null : ((ValueComparer>)nullableDateTime.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateTime)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateTimeArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray)), source.GetCurrentValue>(nullableDecimal) == null ? null : ((ValueComparer>)nullableDecimal.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDecimal)), (IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDecimalArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray)), source.GetCurrentValue>(nullableDouble) == null ? null : ((ValueComparer>)nullableDouble.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDouble)), (IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDoubleArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray)), source.GetCurrentValue>(nullableEnum16) == null ? null : ((ValueComparer>)nullableEnum16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array)), source.GetCurrentValue>(nullableEnum16AsString) == null ? null : ((ValueComparer>)nullableEnum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16AsString))); + var entity3 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg3 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable>((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection)), source.GetCurrentValue>(nullableEnum32) == null ? null : ((ValueComparer>)nullableEnum32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array)), source.GetCurrentValue>(nullableEnum32AsString) == null ? null : ((ValueComparer>)nullableEnum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection)), source.GetCurrentValue>(nullableEnum64) == null ? null : ((ValueComparer>)nullableEnum64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array)), source.GetCurrentValue>(nullableEnum64AsString) == null ? null : ((ValueComparer>)nullableEnum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection)), source.GetCurrentValue>(nullableEnum8) == null ? null : ((ValueComparer>)nullableEnum8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array)), source.GetCurrentValue>(nullableEnum8AsString) == null ? null : ((ValueComparer>)nullableEnum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection)), source.GetCurrentValue>(nullableEnumU16) == null ? null : ((ValueComparer>)nullableEnumU16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array)), source.GetCurrentValue>(nullableEnumU16AsString) == null ? null : ((ValueComparer>)nullableEnumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection)), source.GetCurrentValue>(nullableEnumU32) == null ? null : ((ValueComparer>)nullableEnumU32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array)), source.GetCurrentValue>(nullableEnumU32AsString) == null ? null : ((ValueComparer>)nullableEnumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32AsString))); + var entity4 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg4 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], IPAddress, IPAddress[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], PhysicalAddress>((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection)), source.GetCurrentValue>(nullableEnumU64) == null ? null : ((ValueComparer>)nullableEnumU64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array)), source.GetCurrentValue>(nullableEnumU64AsString) == null ? null : ((ValueComparer>)nullableEnumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection)), source.GetCurrentValue>(nullableEnumU8) == null ? null : ((ValueComparer>)nullableEnumU8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array)), source.GetCurrentValue>(nullableEnumU8AsString) == null ? null : ((ValueComparer>)nullableEnumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection)), source.GetCurrentValue>(nullableFloat) == null ? null : ((ValueComparer>)nullableFloat.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableFloat)), (IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray) == null ? null : (Nullable[])((ValueComparer>>)nullableFloatArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray)), source.GetCurrentValue>(nullableGuid) == null ? null : ((ValueComparer>)nullableGuid.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableGuid)), (IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray) == null ? null : (Nullable[])((ValueComparer>>)nullableGuidArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray)), source.GetCurrentValue(nullableIPAddress) == null ? null : ((ValueComparer)nullableIPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableIPAddress)), (IEnumerable)source.GetCurrentValue(nullableIPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)nullableIPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableIPAddressArray)), source.GetCurrentValue>(nullableInt16) == null ? null : ((ValueComparer>)nullableInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array)), source.GetCurrentValue>(nullableInt32) == null ? null : ((ValueComparer>)nullableInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array)), source.GetCurrentValue>(nullableInt64) == null ? null : ((ValueComparer>)nullableInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array)), source.GetCurrentValue>(nullableInt8) == null ? null : ((ValueComparer>)nullableInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array)), source.GetCurrentValue(nullablePhysicalAddress) == null ? null : ((ValueComparer)nullablePhysicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullablePhysicalAddress))); + var entity5 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg5 = (ISnapshot)new Snapshot, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Uri, Uri[], PhysicalAddress, PhysicalAddress[], PhysicalAddress, PhysicalAddress, string, string[], string, string, string, string, string, string, string>((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)nullablePhysicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray)), source.GetCurrentValue(nullableString) == null ? null : ((ValueComparer)nullableString.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableString)), (IEnumerable)source.GetCurrentValue(nullableStringArray) == null ? null : (string[])((ValueComparer>)nullableStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableStringArray)), source.GetCurrentValue>(nullableTimeOnly) == null ? null : ((ValueComparer>)nullableTimeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray)), source.GetCurrentValue>(nullableTimeSpan) == null ? null : ((ValueComparer>)nullableTimeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeSpan)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeSpanArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray)), source.GetCurrentValue>(nullableUInt16) == null ? null : ((ValueComparer>)nullableUInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array)), source.GetCurrentValue>(nullableUInt32) == null ? null : ((ValueComparer>)nullableUInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array)), source.GetCurrentValue>(nullableUInt64) == null ? null : ((ValueComparer>)nullableUInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array)), source.GetCurrentValue>(nullableUInt8) == null ? null : ((ValueComparer>)nullableUInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array)), source.GetCurrentValue(nullableUri) == null ? null : ((ValueComparer)nullableUri.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableUri)), (IEnumerable)source.GetCurrentValue(nullableUriArray) == null ? null : (Uri[])((ValueComparer>)nullableUriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableUriArray)), source.GetCurrentValue(physicalAddress) == null ? null : ((ValueComparer)physicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddress)), (IEnumerable)source.GetCurrentValue(physicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)physicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(physicalAddressArray)), source.GetCurrentValue(physicalAddressToBytesConverterProperty) == null ? null : ((ValueComparer)physicalAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToBytesConverterProperty)), source.GetCurrentValue(physicalAddressToStringConverterProperty) == null ? null : ((ValueComparer)physicalAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToStringConverterProperty)), source.GetCurrentValue(@string) == null ? null : ((ValueComparer)@string.GetValueComparer()).Snapshot(source.GetCurrentValue(@string)), (IEnumerable)source.GetCurrentValue(stringArray) == null ? null : (string[])((ValueComparer>)stringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(stringArray)), source.GetCurrentValue(stringToBoolConverterProperty) == null ? null : ((ValueComparer)stringToBoolConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBoolConverterProperty)), source.GetCurrentValue(stringToBytesConverterProperty) == null ? null : ((ValueComparer)stringToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBytesConverterProperty)), source.GetCurrentValue(stringToCharConverterProperty) == null ? null : ((ValueComparer)stringToCharConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToCharConverterProperty)), source.GetCurrentValue(stringToDateOnlyConverterProperty) == null ? null : ((ValueComparer)stringToDateOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateOnlyConverterProperty)), source.GetCurrentValue(stringToDateTimeConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeConverterProperty)), source.GetCurrentValue(stringToDateTimeOffsetConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeOffsetConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeOffsetConverterProperty)), source.GetCurrentValue(stringToDecimalNumberConverterProperty) == null ? null : ((ValueComparer)stringToDecimalNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDecimalNumberConverterProperty))); + var entity6 = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, liftedArg0, liftedArg1, liftedArg2, liftedArg3, liftedArg4, liftedArg5, (ISnapshot)new Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty) == null ? null : ((ValueComparer)stringToDoubleNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty)), source.GetCurrentValue(stringToEnumConverterProperty) == null ? null : ((ValueComparer)stringToEnumConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToEnumConverterProperty)), source.GetCurrentValue(stringToGuidConverterProperty) == null ? null : ((ValueComparer)stringToGuidConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToGuidConverterProperty)), source.GetCurrentValue(stringToIntNumberConverterProperty) == null ? null : ((ValueComparer)stringToIntNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToIntNumberConverterProperty)), source.GetCurrentValue(stringToTimeOnlyConverterProperty) == null ? null : ((ValueComparer)stringToTimeOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeOnlyConverterProperty)), source.GetCurrentValue(stringToTimeSpanConverterProperty) == null ? null : ((ValueComparer)stringToTimeSpanConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeSpanConverterProperty)), source.GetCurrentValue(stringToUriConverterProperty) == null ? null : ((ValueComparer)stringToUriConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToUriConverterProperty)), ((ValueComparer)timeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnly)), (IEnumerable)source.GetCurrentValue(timeOnlyArray) == null ? null : (TimeOnly[])((ValueComparer>)timeOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeOnlyArray)), ((ValueComparer)timeOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToStringConverterProperty)), ((ValueComparer)timeOnlyToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToTicksConverterProperty)), ((ValueComparer)timeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpan)), (IEnumerable)source.GetCurrentValue(timeSpanArray) == null ? null : (TimeSpan[])((ValueComparer>)timeSpanArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeSpanArray)), ((ValueComparer)timeSpanToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToStringConverterProperty)), ((ValueComparer)timeSpanToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToTicksConverterProperty)), ((ValueComparer)uInt16.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt16)), (IEnumerable)source.GetCurrentValue(uInt16Array) == null ? null : (ushort[])((ValueComparer>)uInt16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt16Array)), ((ValueComparer)uInt32.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt32)), (IEnumerable)source.GetCurrentValue(uInt32Array) == null ? null : (uint[])((ValueComparer>)uInt32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt32Array)), ((ValueComparer)uInt64.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt64)), (IEnumerable)source.GetCurrentValue(uInt64Array) == null ? null : (ulong[])((ValueComparer>)uInt64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt64Array)), ((ValueComparer)uInt8.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8)), source.GetCurrentValue(uInt8Array) == null ? null : ((ValueComparer)uInt8Array.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8Array)), source.GetCurrentValue(uri) == null ? null : ((ValueComparer)uri.GetValueComparer()).Snapshot(source.GetCurrentValue(uri)), (IEnumerable)source.GetCurrentValue(uriArray) == null ? null : (Uri[])((ValueComparer>)uriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uriArray)), source.GetCurrentValue(uriToStringConverterProperty) == null ? null : ((ValueComparer)uriToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(uriToStringConverterProperty))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(CompiledModelTestBase.ManyTypesId)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(CompiledModelTestBase.ManyTypesId))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 236, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 236, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -8299,5 +13537,2129 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.ManyTypesId GetId(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.ManyTypesId ReadId(CompiledModelTestBase.ManyTypes @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.ManyTypesId value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBool(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBool(CompiledModelTestBase.ManyTypes @this) + => GetBool(@this); + + public static void WriteBool(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool[] GetBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool[] ReadBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetBoolArray(@this); + + public static void WriteBoolArray(CompiledModelTestBase.ManyTypes @this, bool[] value) + => GetBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToStringConverterProperty(@this); + + public static void WriteBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToTwoValuesConverterProperty(@this); + + public static void WriteBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToTwoValuesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToZeroOneConverterProperty(@this); + + public static void WriteBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToZeroOneConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytes(CompiledModelTestBase.ManyTypes @this) + => GetBytes(@this); + + public static void WriteBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetBytesArray(@this); + + public static void WriteBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBytesToStringConverterProperty(@this); + + public static void WriteBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytesToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetCastingConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadCastingConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCastingConverterProperty(@this); + + public static void WriteCastingConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetCastingConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetChar(CompiledModelTestBase.ManyTypes @this); + + public static char ReadChar(CompiledModelTestBase.ManyTypes @this) + => GetChar(@this); + + public static void WriteChar(CompiledModelTestBase.ManyTypes @this, char value) + => GetChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char[] GetCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char[] ReadCharArray(CompiledModelTestBase.ManyTypes @this) + => GetCharArray(@this); + + public static void WriteCharArray(CompiledModelTestBase.ManyTypes @this, char[] value) + => GetCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static char ReadCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCharToStringConverterProperty(@this); + + public static void WriteCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, char value) + => GetCharToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetDateOnly(@this); + + public static void WriteDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly[] GetDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly[] ReadDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyArray(@this); + + public static void WriteDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly[] value) + => GetDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyToStringConverterProperty(@this); + + public static void WriteDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTime(CompiledModelTestBase.ManyTypes @this) + => GetDateTime(@this); + + public static void WriteDateTime(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime[] ReadDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeArray(@this); + + public static void WriteDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime[] value) + => GetDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBinaryConverterProperty(@this); + + public static void WriteDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBytesConverterProperty(@this); + + public static void WriteDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToStringConverterProperty(@this); + + public static void WriteDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToBinaryConverterProperty(@this); + + public static void WriteDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToStringConverterProperty(@this); + + public static void WriteDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToTicksConverterProperty(@this); + + public static void WriteDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimal(CompiledModelTestBase.ManyTypes @this) + => GetDecimal(@this); + + public static void WriteDecimal(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal[] GetDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal[] ReadDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetDecimalArray(@this); + + public static void WriteDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal[] value) + => GetDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToBytesConverterProperty(@this); + + public static void WriteDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToStringConverterProperty(@this); + + public static void WriteDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDouble(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDouble(CompiledModelTestBase.ManyTypes @this) + => GetDouble(@this); + + public static void WriteDouble(CompiledModelTestBase.ManyTypes @this, double value) + => GetDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double[] GetDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double[] ReadDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetDoubleArray(@this); + + public static void WriteDoubleArray(CompiledModelTestBase.ManyTypes @this, double[] value) + => GetDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToBytesConverterProperty(@this); + + public static void WriteDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToStringConverterProperty(@this); + + public static void WriteDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16(CompiledModelTestBase.ManyTypes @this) + => GetEnum16(@this); + + public static void WriteEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Array(@this); + + public static void WriteEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsString(@this); + + public static void WriteEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringArray(@this); + + public static void WriteEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringCollection(@this); + + public static void WriteEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Collection(@this); + + public static void WriteEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32(CompiledModelTestBase.ManyTypes @this) + => GetEnum32(@this); + + public static void WriteEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Array(@this); + + public static void WriteEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsString(@this); + + public static void WriteEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringArray(@this); + + public static void WriteEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringCollection(@this); + + public static void WriteEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Collection(@this); + + public static void WriteEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64(CompiledModelTestBase.ManyTypes @this) + => GetEnum64(@this); + + public static void WriteEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Array(@this); + + public static void WriteEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsString(@this); + + public static void WriteEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringArray(@this); + + public static void WriteEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringCollection(@this); + + public static void WriteEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Collection(@this); + + public static void WriteEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8(CompiledModelTestBase.ManyTypes @this) + => GetEnum8(@this); + + public static void WriteEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Array(@this); + + public static void WriteEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsString(@this); + + public static void WriteEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringArray(@this); + + public static void WriteEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringCollection(@this); + + public static void WriteEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Collection(@this); + + public static void WriteEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToNumberConverterProperty(@this); + + public static void WriteEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToStringConverterProperty(@this); + + public static void WriteEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16(@this); + + public static void WriteEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Array(@this); + + public static void WriteEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsString(@this); + + public static void WriteEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringArray(@this); + + public static void WriteEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringCollection(@this); + + public static void WriteEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Collection(@this); + + public static void WriteEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32(@this); + + public static void WriteEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Array(@this); + + public static void WriteEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsString(@this); + + public static void WriteEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringArray(@this); + + public static void WriteEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringCollection(@this); + + public static void WriteEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Collection(@this); + + public static void WriteEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64(@this); + + public static void WriteEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Array(@this); + + public static void WriteEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsString(@this); + + public static void WriteEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringArray(@this); + + public static void WriteEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringCollection(@this); + + public static void WriteEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Collection(@this); + + public static void WriteEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8(@this); + + public static void WriteEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Array(@this); + + public static void WriteEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsString(@this); + + public static void WriteEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringArray(@this); + + public static void WriteEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringCollection(@this); + + public static void WriteEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Collection(@this); + + public static void WriteEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float GetFloat(CompiledModelTestBase.ManyTypes @this); + + public static float ReadFloat(CompiledModelTestBase.ManyTypes @this) + => GetFloat(@this); + + public static void WriteFloat(CompiledModelTestBase.ManyTypes @this, float value) + => GetFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float[] GetFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float[] ReadFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetFloatArray(@this); + + public static void WriteFloatArray(CompiledModelTestBase.ManyTypes @this, float[] value) + => GetFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuid(CompiledModelTestBase.ManyTypes @this) + => GetGuid(@this); + + public static void WriteGuid(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid[] GetGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid[] ReadGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetGuidArray(@this); + + public static void WriteGuidArray(CompiledModelTestBase.ManyTypes @this, Guid[] value) + => GetGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToBytesConverterProperty(@this); + + public static void WriteGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToStringConverterProperty(@this); + + public static void WriteGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetIPAddress(@this); + + public static void WriteIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressArray(@this); + + public static void WriteIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToBytesConverterProperty(@this); + + public static void WriteIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToStringConverterProperty(@this); + + public static void WriteIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short GetInt16(CompiledModelTestBase.ManyTypes @this); + + public static short ReadInt16(CompiledModelTestBase.ManyTypes @this) + => GetInt16(@this); + + public static void WriteInt16(CompiledModelTestBase.ManyTypes @this, short value) + => GetInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short[] GetInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short[] ReadInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetInt16Array(@this); + + public static void WriteInt16Array(CompiledModelTestBase.ManyTypes @this, short[] value) + => GetInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetInt32(CompiledModelTestBase.ManyTypes @this); + + public static int ReadInt32(CompiledModelTestBase.ManyTypes @this) + => GetInt32(@this); + + public static void WriteInt32(CompiledModelTestBase.ManyTypes @this, int value) + => GetInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int[] GetInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int[] ReadInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetInt32Array(@this); + + public static void WriteInt32Array(CompiledModelTestBase.ManyTypes @this, int[] value) + => GetInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetInt64(CompiledModelTestBase.ManyTypes @this); + + public static long ReadInt64(CompiledModelTestBase.ManyTypes @this) + => GetInt64(@this); + + public static void WriteInt64(CompiledModelTestBase.ManyTypes @this, long value) + => GetInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long[] GetInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long[] ReadInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetInt64Array(@this); + + public static void WriteInt64Array(CompiledModelTestBase.ManyTypes @this, long[] value) + => GetInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte GetInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte ReadInt8(CompiledModelTestBase.ManyTypes @this) + => GetInt8(@this); + + public static void WriteInt8(CompiledModelTestBase.ManyTypes @this, sbyte value) + => GetInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte[] GetInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte[] ReadInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetInt8Array(@this); + + public static void WriteInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte[] value) + => GetInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToBytesConverterProperty(@this); + + public static void WriteIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToStringConverterProperty(@this); + + public static void WriteIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetNullIntToNullStringConverterProperty(@this); + + public static void WriteNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullIntToNullStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool? GetNullableBool(CompiledModelTestBase.ManyTypes @this); + + public static bool? ReadNullableBool(CompiledModelTestBase.ManyTypes @this) + => GetNullableBool(@this); + + public static void WriteNullableBool(CompiledModelTestBase.ManyTypes @this, bool? value) + => GetNullableBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool?[] GetNullableBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool?[] ReadNullableBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBoolArray(@this); + + public static void WriteNullableBoolArray(CompiledModelTestBase.ManyTypes @this, bool?[] value) + => GetNullableBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetNullableBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadNullableBytes(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytes(@this); + + public static void WriteNullableBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetNullableBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetNullableBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadNullableBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytesArray(@this); + + public static void WriteNullableBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetNullableBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char? GetNullableChar(CompiledModelTestBase.ManyTypes @this); + + public static char? ReadNullableChar(CompiledModelTestBase.ManyTypes @this) + => GetNullableChar(@this); + + public static void WriteNullableChar(CompiledModelTestBase.ManyTypes @this, char? value) + => GetNullableChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char?[] GetNullableCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char?[] ReadNullableCharArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableCharArray(@this); + + public static void WriteNullableCharArray(CompiledModelTestBase.ManyTypes @this, char?[] value) + => GetNullableCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly? GetNullableDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly? ReadNullableDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnly(@this); + + public static void WriteNullableDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly? value) + => GetNullableDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly?[] GetNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly?[] ReadNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnlyArray(@this); + + public static void WriteNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly?[] value) + => GetNullableDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime? GetNullableDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime? ReadNullableDateTime(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTime(@this); + + public static void WriteNullableDateTime(CompiledModelTestBase.ManyTypes @this, DateTime? value) + => GetNullableDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime?[] GetNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime?[] ReadNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTimeArray(@this); + + public static void WriteNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime?[] value) + => GetNullableDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal? GetNullableDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal? ReadNullableDecimal(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimal(@this); + + public static void WriteNullableDecimal(CompiledModelTestBase.ManyTypes @this, decimal? value) + => GetNullableDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal?[] GetNullableDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal?[] ReadNullableDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimalArray(@this); + + public static void WriteNullableDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal?[] value) + => GetNullableDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double? GetNullableDouble(CompiledModelTestBase.ManyTypes @this); + + public static double? ReadNullableDouble(CompiledModelTestBase.ManyTypes @this) + => GetNullableDouble(@this); + + public static void WriteNullableDouble(CompiledModelTestBase.ManyTypes @this, double? value) + => GetNullableDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double?[] GetNullableDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double?[] ReadNullableDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDoubleArray(@this); + + public static void WriteNullableDoubleArray(CompiledModelTestBase.ManyTypes @this, double?[] value) + => GetNullableDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16(@this); + + public static void WriteNullableEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Array(@this); + + public static void WriteNullableEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsString(@this); + + public static void WriteNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringArray(@this); + + public static void WriteNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringCollection(@this); + + public static void WriteNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Collection(@this); + + public static void WriteNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32(@this); + + public static void WriteNullableEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Array(@this); + + public static void WriteNullableEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsString(@this); + + public static void WriteNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringArray(@this); + + public static void WriteNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringCollection(@this); + + public static void WriteNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Collection(@this); + + public static void WriteNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64(@this); + + public static void WriteNullableEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Array(@this); + + public static void WriteNullableEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsString(@this); + + public static void WriteNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringArray(@this); + + public static void WriteNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringCollection(@this); + + public static void WriteNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Collection(@this); + + public static void WriteNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8(@this); + + public static void WriteNullableEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Array(@this); + + public static void WriteNullableEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsString(@this); + + public static void WriteNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringArray(@this); + + public static void WriteNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringCollection(@this); + + public static void WriteNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Collection(@this); + + public static void WriteNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16(@this); + + public static void WriteNullableEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Array(@this); + + public static void WriteNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsString(@this); + + public static void WriteNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringArray(@this); + + public static void WriteNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringCollection(@this); + + public static void WriteNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Collection(@this); + + public static void WriteNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32(@this); + + public static void WriteNullableEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Array(@this); + + public static void WriteNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsString(@this); + + public static void WriteNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringArray(@this); + + public static void WriteNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringCollection(@this); + + public static void WriteNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Collection(@this); + + public static void WriteNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64(@this); + + public static void WriteNullableEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Array(@this); + + public static void WriteNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsString(@this); + + public static void WriteNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringArray(@this); + + public static void WriteNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringCollection(@this); + + public static void WriteNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Collection(@this); + + public static void WriteNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8(@this); + + public static void WriteNullableEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Array(@this); + + public static void WriteNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsString(@this); + + public static void WriteNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringArray(@this); + + public static void WriteNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringCollection(@this); + + public static void WriteNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Collection(@this); + + public static void WriteNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float? GetNullableFloat(CompiledModelTestBase.ManyTypes @this); + + public static float? ReadNullableFloat(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloat(@this); + + public static void WriteNullableFloat(CompiledModelTestBase.ManyTypes @this, float? value) + => GetNullableFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float?[] GetNullableFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float?[] ReadNullableFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloatArray(@this); + + public static void WriteNullableFloatArray(CompiledModelTestBase.ManyTypes @this, float?[] value) + => GetNullableFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid? GetNullableGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid? ReadNullableGuid(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuid(@this); + + public static void WriteNullableGuid(CompiledModelTestBase.ManyTypes @this, Guid? value) + => GetNullableGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid?[] GetNullableGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid?[] ReadNullableGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuidArray(@this); + + public static void WriteNullableGuidArray(CompiledModelTestBase.ManyTypes @this, Guid?[] value) + => GetNullableGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetNullableIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadNullableIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddress(@this); + + public static void WriteNullableIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetNullableIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddressArray(@this); + + public static void WriteNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetNullableIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short? GetNullableInt16(CompiledModelTestBase.ManyTypes @this); + + public static short? ReadNullableInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16(@this); + + public static void WriteNullableInt16(CompiledModelTestBase.ManyTypes @this, short? value) + => GetNullableInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short?[] GetNullableInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short?[] ReadNullableInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16Array(@this); + + public static void WriteNullableInt16Array(CompiledModelTestBase.ManyTypes @this, short?[] value) + => GetNullableInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullableInt32(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullableInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32(@this); + + public static void WriteNullableInt32(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullableInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int?[] GetNullableInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int?[] ReadNullableInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32Array(@this); + + public static void WriteNullableInt32Array(CompiledModelTestBase.ManyTypes @this, int?[] value) + => GetNullableInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetNullableInt64(CompiledModelTestBase.ManyTypes @this); + + public static long? ReadNullableInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64(@this); + + public static void WriteNullableInt64(CompiledModelTestBase.ManyTypes @this, long? value) + => GetNullableInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long?[] GetNullableInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long?[] ReadNullableInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64Array(@this); + + public static void WriteNullableInt64Array(CompiledModelTestBase.ManyTypes @this, long?[] value) + => GetNullableInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte? GetNullableInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte? ReadNullableInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8(@this); + + public static void WriteNullableInt8(CompiledModelTestBase.ManyTypes @this, sbyte? value) + => GetNullableInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte?[] GetNullableInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte?[] ReadNullableInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8Array(@this); + + public static void WriteNullableInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte?[] value) + => GetNullableInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddress(@this); + + public static void WriteNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetNullablePhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddressArray(@this); + + public static void WriteNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetNullablePhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNullableString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadNullableString(CompiledModelTestBase.ManyTypes @this) + => GetNullableString(@this); + + public static void WriteNullableString(CompiledModelTestBase.ManyTypes @this, string value) + => GetNullableString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetNullableStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadNullableStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableStringArray(@this); + + public static void WriteNullableStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetNullableStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly? GetNullableTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly? ReadNullableTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnly(@this); + + public static void WriteNullableTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly? value) + => GetNullableTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly?[] GetNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly?[] ReadNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnlyArray(@this); + + public static void WriteNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly?[] value) + => GetNullableTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan? GetNullableTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan? ReadNullableTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpan(@this); + + public static void WriteNullableTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan? value) + => GetNullableTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan?[] GetNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan?[] ReadNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpanArray(@this); + + public static void WriteNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan?[] value) + => GetNullableTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort? GetNullableUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort? ReadNullableUInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16(@this); + + public static void WriteNullableUInt16(CompiledModelTestBase.ManyTypes @this, ushort? value) + => GetNullableUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort?[] GetNullableUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort?[] ReadNullableUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16Array(@this); + + public static void WriteNullableUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort?[] value) + => GetNullableUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint? GetNullableUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint? ReadNullableUInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32(@this); + + public static void WriteNullableUInt32(CompiledModelTestBase.ManyTypes @this, uint? value) + => GetNullableUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint?[] GetNullableUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint?[] ReadNullableUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32Array(@this); + + public static void WriteNullableUInt32Array(CompiledModelTestBase.ManyTypes @this, uint?[] value) + => GetNullableUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong? GetNullableUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong? ReadNullableUInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64(@this); + + public static void WriteNullableUInt64(CompiledModelTestBase.ManyTypes @this, ulong? value) + => GetNullableUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong?[] GetNullableUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong?[] ReadNullableUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64Array(@this); + + public static void WriteNullableUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong?[] value) + => GetNullableUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetNullableUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte? ReadNullableUInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8(@this); + + public static void WriteNullableUInt8(CompiledModelTestBase.ManyTypes @this, byte? value) + => GetNullableUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte?[] GetNullableUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte?[] ReadNullableUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8Array(@this); + + public static void WriteNullableUInt8Array(CompiledModelTestBase.ManyTypes @this, byte?[] value) + => GetNullableUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetNullableUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadNullableUri(CompiledModelTestBase.ManyTypes @this) + => GetNullableUri(@this); + + public static void WriteNullableUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetNullableUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetNullableUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadNullableUriArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableUriArray(@this); + + public static void WriteNullableUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetNullableUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddress(@this); + + public static void WritePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressArray(@this); + + public static void WritePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetPhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToBytesConverterProperty(@this); + + public static void WritePhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToStringConverterProperty(@this); + + public static void WritePhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadString(CompiledModelTestBase.ManyTypes @this) + => GetString(@this); + + public static void WriteString(CompiledModelTestBase.ManyTypes @this, string value) + => GetString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadStringArray(CompiledModelTestBase.ManyTypes @this) + => GetStringArray(@this); + + public static void WriteStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBoolConverterProperty(@this); + + public static void WriteStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBoolConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBytesConverterProperty(@this); + + public static void WriteStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToCharConverterProperty(@this); + + public static void WriteStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToCharConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateOnlyConverterProperty(@this); + + public static void WriteStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeConverterProperty(@this); + + public static void WriteStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeOffsetConverterProperty(@this); + + public static void WriteStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeOffsetConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDecimalNumberConverterProperty(@this); + + public static void WriteStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDecimalNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDoubleNumberConverterProperty(@this); + + public static void WriteStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDoubleNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToEnumConverterProperty(@this); + + public static void WriteStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToEnumConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToGuidConverterProperty(@this); + + public static void WriteStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToGuidConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToIntNumberConverterProperty(@this); + + public static void WriteStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToIntNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeOnlyConverterProperty(@this); + + public static void WriteStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeSpanConverterProperty(@this); + + public static void WriteStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeSpanConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToUriConverterProperty(@this); + + public static void WriteStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToUriConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnly(@this); + + public static void WriteTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly[] GetTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly[] ReadTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyArray(@this); + + public static void WriteTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly[] value) + => GetTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToStringConverterProperty(@this); + + public static void WriteTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToTicksConverterProperty(@this); + + public static void WriteTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpan(@this); + + public static void WriteTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan[] GetTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan[] ReadTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanArray(@this); + + public static void WriteTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan[] value) + => GetTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToStringConverterProperty(@this); + + public static void WriteTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToTicksConverterProperty(@this); + + public static void WriteTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort GetUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort ReadUInt16(CompiledModelTestBase.ManyTypes @this) + => GetUInt16(@this); + + public static void WriteUInt16(CompiledModelTestBase.ManyTypes @this, ushort value) + => GetUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort[] GetUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort[] ReadUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt16Array(@this); + + public static void WriteUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort[] value) + => GetUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint GetUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint ReadUInt32(CompiledModelTestBase.ManyTypes @this) + => GetUInt32(@this); + + public static void WriteUInt32(CompiledModelTestBase.ManyTypes @this, uint value) + => GetUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint[] GetUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint[] ReadUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt32Array(@this); + + public static void WriteUInt32Array(CompiledModelTestBase.ManyTypes @this, uint[] value) + => GetUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong GetUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong ReadUInt64(CompiledModelTestBase.ManyTypes @this) + => GetUInt64(@this); + + public static void WriteUInt64(CompiledModelTestBase.ManyTypes @this, ulong value) + => GetUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong[] GetUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong[] ReadUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt64Array(@this); + + public static void WriteUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong[] value) + => GetUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte GetUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte ReadUInt8(CompiledModelTestBase.ManyTypes @this) + => GetUInt8(@this); + + public static void WriteUInt8(CompiledModelTestBase.ManyTypes @this, byte value) + => GetUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt8Array(@this); + + public static void WriteUInt8Array(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUri(CompiledModelTestBase.ManyTypes @this) + => GetUri(@this); + + public static void WriteUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadUriArray(CompiledModelTestBase.ManyTypes @this) + => GetUriArray(@this); + + public static void WriteUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetUriToStringConverterProperty(@this); + + public static void WriteUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUriToStringConverterProperty(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs index 5b99a4bd31e..8d9b4e46640 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedType0EntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -37,6 +40,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalDerivedId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalDerivedId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -52,13 +61,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); var principalDerivedAlternateId = runtimeEntityType.AddProperty( "PrincipalDerivedAlternateId", typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalDerivedAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalDerivedAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalDerivedAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedAlternateId)); var id = runtimeEntityType.AddProperty( "Id", @@ -66,6 +83,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: 2, + storeGenerationIndex: 2); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -81,6 +104,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var details = runtimeEntityType.AddProperty( "Details", @@ -88,6 +112,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[3]); + details.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqliteStringTypeMapping.Default; var number = runtimeEntityType.AddProperty( @@ -96,6 +141,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[4]); + number.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -118,6 +184,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeArray.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -173,6 +260,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeEnumerable.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -198,6 +306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeIList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -223,6 +352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeList.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -278,6 +428,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeArray.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -303,6 +474,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeEnumerable.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -342,6 +534,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeIList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -381,6 +594,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeList.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -442,11 +676,79 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("ManyOwned", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), eagerLoaded: true); + manyOwned.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance) == null); + manyOwned.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(manyOwned), + null); + manyOwned.SetPropertyIndexes( + index: 3, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + manyOwned.SetCollectionAccessor>, ICollection, CompiledModelTestBase.OwnedType>( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.OwnedType>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var principalDerivedAlternateId = runtimeEntityType.FindProperty("PrincipalDerivedAlternateId")!; + var id = runtimeEntityType.FindProperty("Id")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalDerivedId") ? (long)source["PrincipalDerivedId"] : 0L, source.ContainsKey("PrincipalDerivedAlternateId") ? (Guid)source["PrincipalDerivedAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 13, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 13, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -458,5 +760,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs index f9102652e68..3f86c5cabec 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/OwnedTypeEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -39,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalBaseId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalBaseId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -54,6 +63,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); var overrides = new StoreObjectDictionary(); var principalBaseIdPrincipalBase = new RuntimeRelationalPropertyOverrides( @@ -71,7 +81,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalBaseAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalBaseAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseAlternateId)); var details = runtimeEntityType.AddProperty( "Details", @@ -80,6 +97,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[2]); + details.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqliteStringTypeMapping.Default; var overrides0 = new StoreObjectDictionary(); @@ -99,6 +137,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[3]); + number.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -122,6 +181,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[4]); + refTypeArray.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -178,6 +258,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeEnumerable.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -204,6 +305,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeIList.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -230,6 +352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -286,6 +429,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[8]); + valueTypeArray.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -312,6 +476,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeEnumerable.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -352,6 +537,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeIList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -392,6 +598,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -457,6 +684,27 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyAccessMode: PropertyAccessMode.Field, eagerLoaded: true); + owned.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance) == null); + owned.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(owned), + null); + owned.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); return runtimeForeignKey; } @@ -475,6 +723,46 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalBaseAlternateId = runtimeEntityType.FindProperty("PrincipalBaseAlternateId")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalBaseId") ? (long)source["PrincipalBaseId"] : 0L, source.ContainsKey("PrincipalBaseAlternateId") ? (Guid)source["PrincipalBaseAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"))); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 12, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 12, + shadowCount: 2, + relationshipCount: 2, + storeGeneratedCount: 2); var fragments = new StoreObjectDictionary(); var detailsFragment = new RuntimeEntityTypeMappingFragment( runtimeEntityType, @@ -493,5 +781,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs index 2c8fe38a266..ed2affff57d 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBaseEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -41,6 +44,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue>(0) : entry.FlaggedAsTemporary(0) && !ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity).HasValue ? entry.ReadTemporaryValue>(0) : ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -56,6 +80,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var overrides = new StoreObjectDictionary(); var idPrincipalDerived = new RuntimeRelationalPropertyOverrides( @@ -75,13 +100,56 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000"), jsonValueReaderWriter: JsonGuidReaderWriter.Instance); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(1) ? entry.ReadStoreGeneratedValue(1) : entry.FlaggedAsTemporary(1) && ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId == new Guid("00000000-0000-0000-0000-000000000000") ? entry.ReadTemporaryValue(1) : ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(alternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + alternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); alternateId.TypeMapping = SqliteGuidTypeMapping.Default; + alternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(alternateId)); var enum1 = runtimeEntityType.AddProperty( "Enum1", typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[2]); + enum1.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -113,6 +181,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum2.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -142,6 +231,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[4]); + flagsEnum1.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -172,6 +282,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C)), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C))); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum2.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -205,6 +336,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueConverter: new CastingConverter(), valueComparer: new CompiledModelTestBase.CustomValueComparer(), providerValueComparer: new CompiledModelTestBase.CustomValueComparer()); + point.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: 2); point.TypeMapping = null; point.AddAnnotation("Relational:ColumnType", "geometry"); point.AddAnnotation("Relational:DefaultValue", (NetTopologySuite.Geometries.Point)new NetTopologySuite.IO.WKTReader().Read("SRID=0;POINT Z(0 0 0)")); @@ -215,6 +352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -270,6 +428,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeEnumerable.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -295,6 +474,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeIList.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -320,6 +520,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -375,6 +596,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -400,6 +642,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeEnumerable.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -439,6 +702,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeIList.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -478,6 +762,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -547,11 +852,82 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var point = runtimeEntityType.FindProperty("Point")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Point, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Guid, Point>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(default(Guid)), default(Point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(default(Point)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Guid, Point>(default(Nullable), default(Guid), default(Point))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ReadOwned(entity), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 1, + relationshipCount: 4, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPT"); runtimeEntityType.AddAnnotation("Relational:Schema", "mySchema"); @@ -564,5 +940,140 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs index 43b8727c14d..f637dfc110d 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs @@ -6,7 +6,9 @@ using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +38,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null ? 0L : (long)(entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null ? 0L : (long)(instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null); + derivedsId.SetSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsId, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsId, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + derivedsId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); derivedsId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -51,19 +98,111 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + derivedsId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsId)); var derivedsAlternateId = runtimeEntityType.AddProperty( "DerivedsAlternateId", typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null); + derivedsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(1)) + { + return entry.ReadStoreGeneratedValue(1); + } + else + { + { + if (entry.FlaggedAsTemporary(1) && (((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(1); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsAlternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsAlternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + derivedsAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); derivedsAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + derivedsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsAlternateId)); var principalsId = runtimeEntityType.AddProperty( "PrincipalsId", typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null ? 0L : (long)(entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null ? 0L : (long)(instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null); + principalsId.SetSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(2)) + { + return entry.ReadStoreGeneratedValue(2); + } + else + { + { + if (entry.FlaggedAsTemporary(2) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null) == null) + { + return entry.ReadTemporaryValue(2); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsId, 2), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsId, 2), + (ValueBuffer valueBuffer) => valueBuffer[2]); + principalsId.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: 2); principalsId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -79,13 +218,60 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalsId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsId)); var principalsAlternateId = runtimeEntityType.AddProperty( "PrincipalsAlternateId", typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null); + principalsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(3)) + { + return entry.ReadStoreGeneratedValue(3); + } + else + { + { + if (entry.FlaggedAsTemporary(3) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(3); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsAlternateId, 3), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsAlternateId, 3), + (ValueBuffer valueBuffer) => valueBuffer[3]); + principalsAlternateId.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: 3); principalsAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsAlternateId)); var rowid = runtimeEntityType.AddProperty( "rowid", @@ -96,19 +282,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + rowid.SetGetter( + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null ? null : (byte[])(entity.ContainsKey("rowid") ? entity["rowid"] : null), + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null ? null : (byte[])(instance.ContainsKey("rowid") ? instance["rowid"] : null), + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null); + rowid.SetSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetMaterializationSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(4) ? entry.ReadStoreGeneratedValue(4) : entry.FlaggedAsTemporary(4) && (((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null) == null ? entry.ReadTemporaryValue(4) : (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => entry.ReadOriginalValue(rowid, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(rowid), + (ValueBuffer valueBuffer) => valueBuffer[4]); + rowid.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 4); rowid.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var key = runtimeEntityType.AddKey( new[] { derivedsId, derivedsAlternateId, principalsId, principalsAlternateId }); @@ -144,6 +351,39 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var derivedsId = runtimeEntityType.FindProperty("DerivedsId")!; + var derivedsAlternateId = runtimeEntityType.FindProperty("DerivedsAlternateId")!; + var principalsId = runtimeEntityType.FindProperty("PrincipalsId")!; + var principalsAlternateId = runtimeEntityType.FindProperty("PrincipalsAlternateId")!; + var rowid = runtimeEntityType.FindProperty("rowid")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId)), source.GetCurrentValue(rowid) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(source.GetCurrentValue(rowid))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(default(Guid)), default(byte[]) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(default(byte[])))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(long), default(Guid), default(byte[]))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 5, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 5, + shadowCount: 0, + relationshipCount: 4, + storeGeneratedCount: 5); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs index 4c3ed5ed544..7bb4d133990 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel/PrincipalDerivedEntityType.cs @@ -1,10 +1,16 @@ // using System; using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using NetTopologySuite.Geometries; #pragma warning disable 219, 612, 618 #nullable disable @@ -53,9 +59,7 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl false, typeof(ICollection), propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: true, - lazyLoadingEnabled: false); + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var inverse = targetEntityType.FindSkipNavigation("Deriveds"); if (inverse != null) @@ -64,11 +68,84 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 4, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 6, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var point = runtimeEntityType.FindProperty("Point")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + var manyOwned = runtimeEntityType.FindNavigation("ManyOwned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Point, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot, Guid, Point>(default(Nullable) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(default(Nullable)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(default(Guid)), default(Point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(default(Point)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot, Guid, Point>(default(Nullable), default(Guid), default(Point))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object, object, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), PrincipalBaseEntityType.ReadOwned(entity), null, ReadDependent(entity), SnapshotFactoryFactory.SnapshotCollection(ReadManyOwned(entity)), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 15, + navigationCount: 5, + complexPropertyCount: 0, + originalValueCount: 15, + shadowCount: 1, + relationshipCount: 7, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -80,5 +157,32 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetPrincipals(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadPrincipals(CompiledModelTestBase.PrincipalDerived> @this) + => GetPrincipals(@this); + + public static void WritePrincipals(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetPrincipals(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "ManyOwned")] + extern static ref ICollection GetManyOwned(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadManyOwned(CompiledModelTestBase.PrincipalDerived> @this) + => GetManyOwned(@this); + + public static void WriteManyOwned(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetManyOwned(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DataEntityType.cs index 14543870017..f3997cd08a5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -32,6 +36,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -47,6 +57,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -54,24 +65,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var point = runtimeEntityType.AddProperty( "Point", typeof(Point), nullable: true); + point.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 1, + relationshipIndex: -1, + storeGenerationIndex: -1); point.TypeMapping = null; var key = runtimeEntityType.AddKey( @@ -83,6 +121,37 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + var point = runtimeEntityType.FindProperty("Point")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0, source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int), default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 3, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 3, + shadowCount: 2, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -94,5 +163,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs index 6ade69519bf..0f6385004bd 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentBaseEntityType.cs @@ -1,9 +1,13 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -38,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -53,19 +63,33 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalId)); var principalAlternateId = runtimeEntityType.AddProperty( "PrincipalAlternateId", typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalAlternateId)); var enumDiscriminator = runtimeEntityType.AddProperty( "EnumDiscriminator", typeof(CompiledModelTestBase.Enum1), afterSaveBehavior: PropertySaveBehavior.Throw, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + enumDiscriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: -1, + storeGenerationIndex: -1); enumDiscriminator.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum1 v1, CompiledModelTestBase.Enum1 v2) => object.Equals((object)v1, (object)v2), @@ -97,6 +121,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + id.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => ReadId(entity), + (CompiledModelTestBase.DependentBase> entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.DependentBase> instance) => ReadId(instance), + (CompiledModelTestBase.DependentBase> instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue>(id), + (ValueBuffer valueBuffer) => valueBuffer[3]); + id.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); id.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -152,6 +197,27 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt propertyInfo: typeof(CompiledModelTestBase.DependentBase).GetProperty("Principal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.DependentBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + principal.SetGetter( + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity), + (CompiledModelTestBase.DependentBase> entity) => DependentBaseEntityType.ReadPrincipal(entity) == null, + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance), + (CompiledModelTestBase.DependentBase> instance) => DependentBaseEntityType.ReadPrincipal(instance) == null); + principal.SetSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetMaterializationSetter( + (CompiledModelTestBase.DependentBase> entity, CompiledModelTestBase.PrincipalDerived>> value) => DependentBaseEntityType.WritePrincipal(entity, value)); + principal.SetAccessors( + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + (InternalEntityEntry entry) => DependentBaseEntityType.ReadPrincipal((CompiledModelTestBase.DependentBase>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>>(principal), + null); + principal.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); var dependent = principalEntityType.AddNavigation("Dependent", runtimeForeignKey, onDependent: false, @@ -161,11 +227,65 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt eagerLoaded: true, lazyLoadingEnabled: false); + dependent.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadDependent(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadDependent(instance) == null); + dependent.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, CompiledModelTestBase.DependentBase> value) => PrincipalDerivedEntityType.WriteDependent(entity, value)); + dependent.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadDependent((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>>(dependent), + null); + dependent.SetPropertyIndexes( + index: 2, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 4, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentBase>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 4, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 4, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("DiscriminatorMappingComplete", false); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); @@ -179,5 +299,23 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetId(CompiledModelTestBase.DependentBase @this); + + public static byte? ReadId(CompiledModelTestBase.DependentBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.DependentBase @this, byte? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.PrincipalDerived> GetPrincipal(CompiledModelTestBase.DependentBase @this); + + public static CompiledModelTestBase.PrincipalDerived> ReadPrincipal(CompiledModelTestBase.DependentBase @this) + => GetPrincipal(@this); + + public static void WritePrincipal(CompiledModelTestBase.DependentBase @this, CompiledModelTestBase.PrincipalDerived> value) + => GetPrincipal(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs index c3e79cfbe6f..c471955bce5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/DependentDerivedEntityType.cs @@ -1,9 +1,15 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable @@ -30,6 +36,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas nullable: true, maxLength: 20, unicode: false); + data.SetGetter( + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity), + (CompiledModelTestBase.DependentDerived> entity) => ReadData(entity) == null, + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance), + (CompiledModelTestBase.DependentDerived> instance) => ReadData(instance) == null); + data.SetSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetMaterializationSetter( + (CompiledModelTestBase.DependentDerived> entity, string value) => WriteData(entity, value)); + data.SetAccessors( + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => ReadData((CompiledModelTestBase.DependentDerived>)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(data, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(data), + (ValueBuffer valueBuffer) => valueBuffer[4]); + data.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); data.TypeMapping = SqliteStringTypeMapping.Default; data.AddAnnotation("Relational:IsFixedLength", true); @@ -39,6 +66,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas precision: 9, scale: 3, sentinel: 0m); + money.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: 3, + relationshipIndex: -1, + storeGenerationIndex: -1); money.TypeMapping = SqliteDecimalTypeMapping.Default; return runtimeEntityType; @@ -46,6 +79,41 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalId = runtimeEntityType.FindProperty("PrincipalId")!; + var principalAlternateId = runtimeEntityType.FindProperty("PrincipalAlternateId")!; + var enumDiscriminator = runtimeEntityType.FindProperty("EnumDiscriminator")!; + var id = runtimeEntityType.FindProperty("Id")!; + var data = runtimeEntityType.FindProperty("Data")!; + var money = runtimeEntityType.FindProperty("Money")!; + var principal = runtimeEntityType.FindNavigation("Principal")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot, string, decimal>(((ValueComparer)principalId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), ((ValueComparer)enumDiscriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(enumDiscriminator)), source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), source.GetCurrentValue(data) == null ? null : ((ValueComparer)data.GetValueComparer()).Snapshot(source.GetCurrentValue(data)), ((ValueComparer)money.GetValueComparer()).Snapshot(source.GetCurrentValue(money))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalId") ? (long)source["PrincipalId"] : 0L, source.ContainsKey("PrincipalAlternateId") ? (Guid)source["PrincipalAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("EnumDiscriminator") ? (CompiledModelTestBase.Enum1)source["EnumDiscriminator"] : CompiledModelTestBase.Enum1.Default, source.ContainsKey("Money") ? (decimal)source["Money"] : 0M)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(CompiledModelTestBase.Enum1), default(decimal))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.DependentDerived>)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalId)), ((ValueComparer)principalAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalAlternateId)), DependentBaseEntityType.ReadPrincipal(entity)); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 6, + navigationCount: 1, + complexPropertyCount: 0, + originalValueCount: 6, + shadowCount: 4, + relationshipCount: 3, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -57,5 +125,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetData(CompiledModelTestBase.DependentDerived @this); + + public static string ReadData(CompiledModelTestBase.DependentDerived @this) + => GetData(@this); + + public static void WriteData(CompiledModelTestBase.DependentDerived @this, string value) + => GetData(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs index 6c5cb015ebc..113d9701fac 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/ManyTypesEntityType.cs @@ -7,9 +7,12 @@ using System.Net; using System.Net.NetworkInformation; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -42,6 +45,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, valueConverter: new CompiledModelTestBase.ManyTypesIdConverter()); + id.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadId(entity).Equals(default(CompiledModelTestBase.ManyTypesId)), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadId(instance).Equals(default(CompiledModelTestBase.ManyTypesId))); + id.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.ManyTypesId value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(0) ? entry.ReadStoreGeneratedValue(0) : entry.FlaggedAsTemporary(0) && ReadId((CompiledModelTestBase.ManyTypes)entry.Entity).Equals(default(CompiledModelTestBase.ManyTypesId)) ? entry.ReadTemporaryValue(0) : ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.ManyTypesId v1, CompiledModelTestBase.ManyTypesId v2) => v1.Equals(v2), @@ -65,6 +89,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas new ValueConverter( (CompiledModelTestBase.ManyTypesId v) => v.Id, (int v) => new CompiledModelTestBase.ManyTypesId(v)))); + id.SetCurrentValueComparer(new CurrentProviderValueComparer(id)); id.SetSentinelFromProviderValue(0); var @bool = runtimeEntityType.AddProperty( @@ -73,6 +98,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: false); + @bool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBool(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBool(instance) == false); + @bool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBool(entity, value)); + @bool.SetAccessors( + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@bool, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(@bool), + (ValueBuffer valueBuffer) => valueBuffer[1]); + @bool.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @bool.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -94,6 +140,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolArray(instance) == null); + boolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool[] value) => WriteBoolArray(entity, value)); + boolArray.SetAccessors( + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolArray, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolArray), + (ValueBuffer valueBuffer) => valueBuffer[2]); + boolArray.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -132,6 +199,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToStringConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToStringConverterProperty(instance) == false); + boolToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToStringConverterProperty(entity, value)); + boolToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToStringConverterProperty, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[3]); + boolToStringConverterProperty.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -162,6 +250,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToTwoValuesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + boolToTwoValuesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToTwoValuesConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToTwoValuesConverterProperty(instance) == false); + boolToTwoValuesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToTwoValuesConverterProperty(entity, value)); + boolToTwoValuesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToTwoValuesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToTwoValuesConverterProperty, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToTwoValuesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[4]); + boolToTwoValuesConverterProperty.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToTwoValuesConverterProperty.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -193,6 +302,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BoolToZeroOneConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BoolToZeroOneConverter()); + boolToZeroOneConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBoolToZeroOneConverterProperty(entity) == false, + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBoolToZeroOneConverterProperty(instance) == false); + boolToZeroOneConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, bool value) => WriteBoolToZeroOneConverterProperty(entity, value)); + boolToZeroOneConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBoolToZeroOneConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(boolToZeroOneConverterProperty, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(boolToZeroOneConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[5]); + boolToZeroOneConverterProperty.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); boolToZeroOneConverterProperty.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (bool v1, bool v2) => v1 == v2, @@ -223,34 +353,76 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Bytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytes(instance) == null); + bytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytes(entity, value)); + bytes.SetAccessors( + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytes, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytes), + (ValueBuffer valueBuffer) => valueBuffer[6]); + bytes.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytes.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var bytesArray = runtimeEntityType.AddProperty( "BytesArray", typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("BytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + bytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesArray(instance) == null); + bytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteBytesArray(entity, value)); + bytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesArray, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesArray), + (ValueBuffer valueBuffer) => valueBuffer[7]); + bytesArray.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -261,17 +433,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas SqliteJsonByteArrayReaderWriter.Instance), elementMapping: SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()))); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()))); var bytesToStringConverterProperty = runtimeEntityType.AddProperty( "BytesToStringConverterProperty", @@ -280,26 +452,47 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new BytesToStringConverter(), valueComparer: new ArrayStructuralComparer()); + bytesToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadBytesToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadBytesToStringConverterProperty(instance) == null); + bytesToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteBytesToStringConverterProperty(entity, value)); + bytesToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadBytesToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(bytesToStringConverterProperty, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(bytesToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[8]); + bytesToStringConverterProperty.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); bytesToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] v) => v.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] v) => v.ToArray()), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), (string v) => v), converter: new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( JsonStringReaderWriter.Instance, new ValueConverter( - (Byte[] v) => Convert.ToBase64String(v), + (byte[] v) => Convert.ToBase64String(v), (string v) => Convert.FromBase64String(v)))); var castingConverterProperty = runtimeEntityType.AddProperty( @@ -308,6 +501,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CastingConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CastingConverter()); + castingConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCastingConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCastingConverterProperty(instance) == 0); + castingConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteCastingConverterProperty(entity, value)); + castingConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCastingConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(castingConverterProperty, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(castingConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[9]); + castingConverterProperty.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); castingConverterProperty.TypeMapping = SqliteDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -337,6 +551,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Char", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: '\0'); + @char.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadChar(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadChar(instance) == '\0'); + @char.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteChar(entity, value)); + @char.SetAccessors( + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@char, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue(@char), + (ValueBuffer valueBuffer) => valueBuffer[10]); + @char.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @char.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -358,6 +593,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + charArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharArray(instance) == null); + charArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char[] value) => WriteCharArray(entity, value)); + charArray.SetAccessors( + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charArray, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue(charArray), + (ValueBuffer valueBuffer) => valueBuffer[11]); + charArray.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (char v1, char v2) => v1 == v2, @@ -397,6 +653,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("CharToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new CharToStringConverter()); + charToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadCharToStringConverterProperty(entity) == '\0', + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadCharToStringConverterProperty(instance) == '\0'); + charToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, char value) => WriteCharToStringConverterProperty(entity, value)); + charToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadCharToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(charToStringConverterProperty, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(charToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[12]); + charToStringConverterProperty.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); charToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (char v1, char v2) => v1 == v2, @@ -428,6 +705,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateOnly(1, 1, 1)); + dateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnly(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnly(instance) == default(DateOnly)); + dateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnly(entity, value)); + dateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnly, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnly), + (ValueBuffer valueBuffer) => valueBuffer[13]); + dateOnly.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnly.TypeMapping = SqliteDateOnlyTypeMapping.Default; var dateOnlyArray = runtimeEntityType.AddProperty( @@ -435,6 +733,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyArray(instance) == null); + dateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly[] value) => WriteDateOnlyArray(entity, value)); + dateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyArray, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[14]); + dateOnlyArray.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -460,6 +779,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateOnlyToStringConverter()); + dateOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateOnlyToStringConverterProperty(entity) == default(DateOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateOnlyToStringConverterProperty(instance) == default(DateOnly)); + dateOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateOnly value) => WriteDateOnlyToStringConverterProperty(entity, value)); + dateOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateOnlyToStringConverterProperty, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[15]); + dateOnlyToStringConverterProperty.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateOnlyToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateOnly v1, DateOnly v2) => v1.Equals(v2), @@ -491,6 +831,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTime(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTime(instance) == default(DateTime)); + dateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTime(entity, value)); + dateTime.SetAccessors( + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTime, 16), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTime), + (ValueBuffer valueBuffer) => valueBuffer[16]); + dateTime.SetPropertyIndexes( + index: 16, + originalValueIndex: 16, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var dateTimeArray = runtimeEntityType.AddProperty( @@ -498,6 +859,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + dateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeArray(instance) == null); + dateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime[] value) => WriteDateTimeArray(entity, value)); + dateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeArray, 17), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[17]); + dateTimeArray.SetPropertyIndexes( + index: 17, + originalValueIndex: 17, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -523,6 +905,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBinaryConverter()); + dateTimeOffsetToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBinaryConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBinaryConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBinaryConverterProperty(entity, value)); + dateTimeOffsetToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBinaryConverterProperty, 18), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[18]); + dateTimeOffsetToBinaryConverterProperty.SetPropertyIndexes( + index: 18, + originalValueIndex: 18, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBinaryConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -554,6 +957,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToBytesConverter()); + dateTimeOffsetToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToBytesConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToBytesConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToBytesConverterProperty(entity, value)); + dateTimeOffsetToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToBytesConverterProperty, 19), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[19]); + dateTimeOffsetToBytesConverterProperty.SetPropertyIndexes( + index: 19, + originalValueIndex: 19, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -564,19 +988,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (DateTimeOffset v) => v.GetHashCode(), (DateTimeOffset v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 12), converter: new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (DateTimeOffset v) => DateTimeOffsetToBytesConverter.ToBytes(v), - (Byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); + (byte[] v) => DateTimeOffsetToBytesConverter.FromBytes(v)))); dateTimeOffsetToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var dateTimeOffsetToStringConverterProperty = runtimeEntityType.AddProperty( @@ -585,6 +1009,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeOffsetToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeOffsetToStringConverter()); + dateTimeOffsetToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeOffsetToStringConverterProperty(entity).EqualsExact(default(DateTimeOffset)), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeOffsetToStringConverterProperty(instance).EqualsExact(default(DateTimeOffset))); + dateTimeOffsetToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTimeOffset value) => WriteDateTimeOffsetToStringConverterProperty(entity, value)); + dateTimeOffsetToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeOffsetToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeOffsetToStringConverterProperty, 20), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeOffsetToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[20]); + dateTimeOffsetToStringConverterProperty.SetPropertyIndexes( + index: 20, + originalValueIndex: 20, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeOffsetToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTimeOffset v1, DateTimeOffset v2) => v1.EqualsExact(v2), @@ -616,6 +1061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToBinaryConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToBinaryConverter()); + dateTimeToBinaryConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToBinaryConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToBinaryConverterProperty(instance) == default(DateTime)); + dateTimeToBinaryConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToBinaryConverterProperty(entity, value)); + dateTimeToBinaryConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToBinaryConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToBinaryConverterProperty, 21), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToBinaryConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[21]); + dateTimeToBinaryConverterProperty.SetPropertyIndexes( + index: 21, + originalValueIndex: 21, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToBinaryConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -647,6 +1113,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new DateTimeToStringConverter()); + dateTimeToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToStringConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToStringConverterProperty(instance) == default(DateTime)); + dateTimeToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToStringConverterProperty(entity, value)); + dateTimeToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToStringConverterProperty, 22), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[22]); + dateTimeToStringConverterProperty.SetPropertyIndexes( + index: 22, + originalValueIndex: 22, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -678,6 +1165,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DateTimeToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + dateTimeToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDateTimeToTicksConverterProperty(entity) == default(DateTime), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDateTimeToTicksConverterProperty(instance) == default(DateTime)); + dateTimeToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, DateTime value) => WriteDateTimeToTicksConverterProperty(entity, value)); + dateTimeToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDateTimeToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(dateTimeToTicksConverterProperty, 23), + (InternalEntityEntry entry) => entry.GetCurrentValue(dateTimeToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[23]); + dateTimeToTicksConverterProperty.SetPropertyIndexes( + index: 23, + originalValueIndex: 23, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); dateTimeToTicksConverterProperty.TypeMapping = SqliteDateTimeTypeMapping.Default; var @decimal = runtimeEntityType.AddProperty( @@ -686,6 +1194,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Decimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0m); + @decimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimal(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimal(instance) == 0M); + @decimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimal(entity, value)); + @decimal.SetAccessors( + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@decimal, 24), + (InternalEntityEntry entry) => entry.GetCurrentValue(@decimal), + (ValueBuffer valueBuffer) => valueBuffer[24]); + @decimal.SetPropertyIndexes( + index: 24, + originalValueIndex: 24, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @decimal.TypeMapping = SqliteDecimalTypeMapping.Default; var decimalArray = runtimeEntityType.AddProperty( @@ -693,6 +1222,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + decimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalArray(instance) == null); + decimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal[] value) => WriteDecimalArray(entity, value)); + decimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalArray, 25), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalArray), + (ValueBuffer valueBuffer) => valueBuffer[25]); + decimalArray.SetPropertyIndexes( + index: 25, + originalValueIndex: 25, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -718,6 +1268,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + decimalNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToBytesConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToBytesConverterProperty(instance) == 0M); + decimalNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToBytesConverterProperty(entity, value)); + decimalNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToBytesConverterProperty, 26), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[26]); + decimalNumberToBytesConverterProperty.SetPropertyIndexes( + index: 26, + originalValueIndex: 26, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -728,19 +1299,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (decimal v) => v.GetHashCode(), (decimal v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (decimal v) => NumberToBytesConverter.DecimalToBytes(v), - (Byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); + (byte[] v) => v == null ? 0M : NumberToBytesConverter.BytesToDecimal(v)))); decimalNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var decimalNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -749,6 +1320,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DecimalNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + decimalNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDecimalNumberToStringConverterProperty(entity) == 0M, + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDecimalNumberToStringConverterProperty(instance) == 0M); + decimalNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, decimal value) => WriteDecimalNumberToStringConverterProperty(entity, value)); + decimalNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDecimalNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(decimalNumberToStringConverterProperty, 27), + (InternalEntityEntry entry) => entry.GetCurrentValue(decimalNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[27]); + decimalNumberToStringConverterProperty.SetPropertyIndexes( + index: 27, + originalValueIndex: 27, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); decimalNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (decimal v1, decimal v2) => v1 == v2, @@ -780,6 +1372,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Double", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0.0); + @double.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDouble(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDouble(instance).Equals(0D)); + @double.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDouble(entity, value)); + @double.SetAccessors( + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@double, 28), + (InternalEntityEntry entry) => entry.GetCurrentValue(@double), + (ValueBuffer valueBuffer) => valueBuffer[28]); + @double.SetPropertyIndexes( + index: 28, + originalValueIndex: 28, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @double.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -801,6 +1414,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + doubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleArray(instance) == null); + doubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double[] value) => WriteDoubleArray(entity, value)); + doubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleArray, 29), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleArray), + (ValueBuffer valueBuffer) => valueBuffer[29]); + doubleArray.SetPropertyIndexes( + index: 29, + originalValueIndex: 29, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -840,6 +1474,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + doubleNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToBytesConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToBytesConverterProperty(instance).Equals(0D)); + doubleNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToBytesConverterProperty(entity, value)); + doubleNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToBytesConverterProperty, 30), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[30]); + doubleNumberToBytesConverterProperty.SetPropertyIndexes( + index: 30, + originalValueIndex: 30, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -850,19 +1505,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (double v) => v.GetHashCode(), (double v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 8), converter: new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (double v) => NumberToBytesConverter.ReverseLong(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); + (byte[] v) => v == null ? 0D : BitConverter.ToDouble(NumberToBytesConverter.ReverseLong(v), 0)))); doubleNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }); var doubleNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -871,6 +1526,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("DoubleNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + doubleNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadDoubleNumberToStringConverterProperty(entity).Equals(0D), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadDoubleNumberToStringConverterProperty(instance).Equals(0D)); + doubleNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, double value) => WriteDoubleNumberToStringConverterProperty(entity, value)); + doubleNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadDoubleNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(doubleNumberToStringConverterProperty, 31), + (InternalEntityEntry entry) => entry.GetCurrentValue(doubleNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[31]); + doubleNumberToStringConverterProperty.SetPropertyIndexes( + index: 31, + originalValueIndex: 31, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); doubleNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (double v1, double v2) => v1.Equals(v2), @@ -901,6 +1577,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16(entity, value)); + enum16.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16, 32), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16), + (ValueBuffer valueBuffer) => valueBuffer[32]); + enum16.SetPropertyIndexes( + index: 32, + originalValueIndex: 32, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -931,6 +1628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Array(instance) == null); + enum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16Array(entity, value)); + enum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16Array, 33), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16Array), + (ValueBuffer valueBuffer) => valueBuffer[33]); + enum16Array.SetPropertyIndexes( + index: 33, + originalValueIndex: 33, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -986,6 +1704,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum16AsString(entity), (object)CompiledModelTestBase.Enum16.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum16AsString(instance), (object)CompiledModelTestBase.Enum16.Default)); + enum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16 value) => WriteEnum16AsString(entity, value)); + enum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsString, 34), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[34]); + enum16AsString.SetPropertyIndexes( + index: 34, + originalValueIndex: 34, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1014,6 +1753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringArray(instance) == null); + enum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum16[] value) => WriteEnum16AsStringArray(entity, value)); + enum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum16AsStringArray, 35), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[35]); + enum16AsStringArray.SetPropertyIndexes( + index: 35, + originalValueIndex: 35, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1066,6 +1826,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16AsStringCollection(instance) == null); + enum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16AsStringCollection(entity, value)); + enum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16AsStringCollection, 36), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[36]); + enum16AsStringCollection.SetPropertyIndexes( + index: 36, + originalValueIndex: 36, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1118,6 +1899,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum16Collection(instance) == null); + enum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum16Collection(entity, value)); + enum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum16Collection, 37), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[37]); + enum16Collection.SetPropertyIndexes( + index: 37, + originalValueIndex: 37, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum16 v1, CompiledModelTestBase.Enum16 v2) => object.Equals((object)v1, (object)v2), @@ -1172,6 +1974,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32(entity, value)); + enum32.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32, 38), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32), + (ValueBuffer valueBuffer) => valueBuffer[38]); + enum32.SetPropertyIndexes( + index: 38, + originalValueIndex: 38, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1202,6 +2025,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Array(instance) == null); + enum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32Array(entity, value)); + enum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32Array, 39), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32Array), + (ValueBuffer valueBuffer) => valueBuffer[39]); + enum32Array.SetPropertyIndexes( + index: 39, + originalValueIndex: 39, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1257,6 +2101,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum32AsString(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum32AsString(instance), (object)CompiledModelTestBase.Enum32.Default)); + enum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnum32AsString(entity, value)); + enum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsString, 40), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[40]); + enum32AsString.SetPropertyIndexes( + index: 40, + originalValueIndex: 40, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1285,6 +2150,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringArray(instance) == null); + enum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32[] value) => WriteEnum32AsStringArray(entity, value)); + enum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum32AsStringArray, 41), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[41]); + enum32AsStringArray.SetPropertyIndexes( + index: 41, + originalValueIndex: 41, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1337,6 +2223,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32AsStringCollection(instance) == null); + enum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32AsStringCollection(entity, value)); + enum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32AsStringCollection, 42), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[42]); + enum32AsStringCollection.SetPropertyIndexes( + index: 42, + originalValueIndex: 42, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1389,6 +2296,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum32Collection(instance) == null); + enum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum32Collection(entity, value)); + enum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum32Collection, 43), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[43]); + enum32Collection.SetPropertyIndexes( + index: 43, + originalValueIndex: 43, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -1443,6 +2371,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64(entity, value)); + enum64.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64, 44), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64), + (ValueBuffer valueBuffer) => valueBuffer[44]); + enum64.SetPropertyIndexes( + index: 44, + originalValueIndex: 44, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1473,6 +2422,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Array(instance) == null); + enum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64Array(entity, value)); + enum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64Array, 45), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64Array), + (ValueBuffer valueBuffer) => valueBuffer[45]); + enum64Array.SetPropertyIndexes( + index: 45, + originalValueIndex: 45, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1528,6 +2498,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum64AsString(entity), (object)CompiledModelTestBase.Enum64.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum64AsString(instance), (object)CompiledModelTestBase.Enum64.Default)); + enum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64 value) => WriteEnum64AsString(entity, value)); + enum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsString, 46), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[46]); + enum64AsString.SetPropertyIndexes( + index: 46, + originalValueIndex: 46, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1556,6 +2547,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringArray(instance) == null); + enum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum64[] value) => WriteEnum64AsStringArray(entity, value)); + enum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum64AsStringArray, 47), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[47]); + enum64AsStringArray.SetPropertyIndexes( + index: 47, + originalValueIndex: 47, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1608,6 +2620,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64AsStringCollection(instance) == null); + enum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64AsStringCollection(entity, value)); + enum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64AsStringCollection, 48), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[48]); + enum64AsStringCollection.SetPropertyIndexes( + index: 48, + originalValueIndex: 48, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1660,6 +2693,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum64Collection(instance) == null); + enum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum64Collection(entity, value)); + enum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum64Collection, 49), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[49]); + enum64Collection.SetPropertyIndexes( + index: 49, + originalValueIndex: 49, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum64 v1, CompiledModelTestBase.Enum64 v2) => object.Equals((object)v1, (object)v2), @@ -1714,6 +2768,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8(entity, value)); + enum8.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8, 50), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8), + (ValueBuffer valueBuffer) => valueBuffer[50]); + enum8.SetPropertyIndexes( + index: 50, + originalValueIndex: 50, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1744,6 +2819,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Array(instance) == null); + enum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8Array(entity, value)); + enum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8Array, 51), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8Array), + (ValueBuffer valueBuffer) => valueBuffer[51]); + enum8Array.SetPropertyIndexes( + index: 51, + originalValueIndex: 51, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1799,6 +2895,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnum8AsString(entity), (object)CompiledModelTestBase.Enum8.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnum8AsString(instance), (object)CompiledModelTestBase.Enum8.Default)); + enum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8 value) => WriteEnum8AsString(entity, value)); + enum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsString, 52), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[52]); + enum8AsString.SetPropertyIndexes( + index: 52, + originalValueIndex: 52, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1827,6 +2944,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringArray(instance) == null); + enum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum8[] value) => WriteEnum8AsStringArray(entity, value)); + enum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum8AsStringArray, 53), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[53]); + enum8AsStringArray.SetPropertyIndexes( + index: 53, + originalValueIndex: 53, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1879,6 +3017,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8AsStringCollection(instance) == null); + enum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8AsStringCollection(entity, value)); + enum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8AsStringCollection, 54), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[54]); + enum8AsStringCollection.SetPropertyIndexes( + index: 54, + originalValueIndex: 54, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1931,6 +3090,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Enum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnum8Collection(instance) == null); + enum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnum8Collection(entity, value)); + enum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum8Collection, 55), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[55]); + enum8Collection.SetPropertyIndexes( + index: 55, + originalValueIndex: 55, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.Enum8 v1, CompiledModelTestBase.Enum8 v2) => object.Equals((object)v1, (object)v2), @@ -1986,6 +3166,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToNumberConverter()); + enumToNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToNumberConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToNumberConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToNumberConverterProperty(entity, value)); + enumToNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToNumberConverterProperty, 56), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[56]); + enumToNumberConverterProperty.SetPropertyIndexes( + index: 56, + originalValueIndex: 56, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2017,6 +3218,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new EnumToStringConverter()); + enumToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumToStringConverterProperty(entity), (object)CompiledModelTestBase.Enum32.Default), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumToStringConverterProperty(instance), (object)CompiledModelTestBase.Enum32.Default)); + enumToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.Enum32 value) => WriteEnumToStringConverterProperty(entity, value)); + enumToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumToStringConverterProperty, 57), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[57]); + enumToStringConverterProperty.SetPropertyIndexes( + index: 57, + originalValueIndex: 57, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.Enum32 v1, CompiledModelTestBase.Enum32 v2) => object.Equals((object)v1, (object)v2), @@ -2045,6 +3267,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16(entity, value)); + enumU16.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16, 58), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16), + (ValueBuffer valueBuffer) => valueBuffer[58]); + enumU16.SetPropertyIndexes( + index: 58, + originalValueIndex: 58, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2075,6 +3318,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Array(instance) == null); + enumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16Array(entity, value)); + enumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16Array, 59), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[59]); + enumU16Array.SetPropertyIndexes( + index: 59, + originalValueIndex: 59, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2130,6 +3394,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU16AsString(entity), (object)CompiledModelTestBase.EnumU16.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU16AsString(instance), (object)CompiledModelTestBase.EnumU16.Min)); + enumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16 value) => WriteEnumU16AsString(entity, value)); + enumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsString, 60), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[60]); + enumU16AsString.SetPropertyIndexes( + index: 60, + originalValueIndex: 60, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2158,6 +3443,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringArray(instance) == null); + enumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU16[] value) => WriteEnumU16AsStringArray(entity, value)); + enumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU16AsStringArray, 61), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[61]); + enumU16AsStringArray.SetPropertyIndexes( + index: 61, + originalValueIndex: 61, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2210,6 +3516,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16AsStringCollection(instance) == null); + enumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16AsStringCollection(entity, value)); + enumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16AsStringCollection, 62), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[62]); + enumU16AsStringCollection.SetPropertyIndexes( + index: 62, + originalValueIndex: 62, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2262,6 +3589,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU16Collection(instance) == null); + enumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU16Collection(entity, value)); + enumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU16Collection, 63), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[63]); + enumU16Collection.SetPropertyIndexes( + index: 63, + originalValueIndex: 63, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU16 v1, CompiledModelTestBase.EnumU16 v2) => object.Equals((object)v1, (object)v2), @@ -2316,6 +3664,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32(entity, value)); + enumU32.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32, 64), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32), + (ValueBuffer valueBuffer) => valueBuffer[64]); + enumU32.SetPropertyIndexes( + index: 64, + originalValueIndex: 64, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2346,6 +3715,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Array(instance) == null); + enumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32Array(entity, value)); + enumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32Array, 65), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[65]); + enumU32Array.SetPropertyIndexes( + index: 65, + originalValueIndex: 65, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2401,6 +3791,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU32AsString(entity), (object)CompiledModelTestBase.EnumU32.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU32AsString(instance), (object)CompiledModelTestBase.EnumU32.Min)); + enumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32 value) => WriteEnumU32AsString(entity, value)); + enumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsString, 66), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[66]); + enumU32AsString.SetPropertyIndexes( + index: 66, + originalValueIndex: 66, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2429,6 +3840,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringArray(instance) == null); + enumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU32[] value) => WriteEnumU32AsStringArray(entity, value)); + enumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU32AsStringArray, 67), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[67]); + enumU32AsStringArray.SetPropertyIndexes( + index: 67, + originalValueIndex: 67, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2481,6 +3913,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32AsStringCollection(instance) == null); + enumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32AsStringCollection(entity, value)); + enumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32AsStringCollection, 68), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[68]); + enumU32AsStringCollection.SetPropertyIndexes( + index: 68, + originalValueIndex: 68, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2533,6 +3986,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU32Collection(instance) == null); + enumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU32Collection(entity, value)); + enumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU32Collection, 69), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[69]); + enumU32Collection.SetPropertyIndexes( + index: 69, + originalValueIndex: 69, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU32 v1, CompiledModelTestBase.EnumU32 v2) => object.Equals((object)v1, (object)v2), @@ -2587,6 +4061,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64(entity, value)); + enumU64.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64, 70), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64), + (ValueBuffer valueBuffer) => valueBuffer[70]); + enumU64.SetPropertyIndexes( + index: 70, + originalValueIndex: 70, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2615,6 +4110,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Array(instance) == null); + enumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64Array(entity, value)); + enumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64Array, 71), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[71]); + enumU64Array.SetPropertyIndexes( + index: 71, + originalValueIndex: 71, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2668,6 +4184,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU64AsString(entity), (object)CompiledModelTestBase.EnumU64.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU64AsString(instance), (object)CompiledModelTestBase.EnumU64.Min)); + enumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64 value) => WriteEnumU64AsString(entity, value)); + enumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsString, 72), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[72]); + enumU64AsString.SetPropertyIndexes( + index: 72, + originalValueIndex: 72, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2696,6 +4233,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringArray(instance) == null); + enumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU64[] value) => WriteEnumU64AsStringArray(entity, value)); + enumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU64AsStringArray, 73), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[73]); + enumU64AsStringArray.SetPropertyIndexes( + index: 73, + originalValueIndex: 73, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2748,6 +4306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64AsStringCollection(instance) == null); + enumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64AsStringCollection(entity, value)); + enumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64AsStringCollection, 74), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[74]); + enumU64AsStringCollection.SetPropertyIndexes( + index: 74, + originalValueIndex: 74, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2800,6 +4379,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU64Collection(instance) == null); + enumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU64Collection(entity, value)); + enumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU64Collection, 75), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[75]); + enumU64Collection.SetPropertyIndexes( + index: 75, + originalValueIndex: 75, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU64 v1, CompiledModelTestBase.EnumU64 v2) => object.Equals((object)v1, (object)v2), @@ -2852,6 +4452,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8(entity, value)); + enumU8.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8, 76), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8), + (ValueBuffer valueBuffer) => valueBuffer[76]); + enumU8.SetPropertyIndexes( + index: 76, + originalValueIndex: 76, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2882,6 +4503,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Array(instance) == null); + enumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8Array(entity, value)); + enumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8Array, 77), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[77]); + enumU8Array.SetPropertyIndexes( + index: 77, + originalValueIndex: 77, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2937,6 +4579,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), providerPropertyType: typeof(string)); + enumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => object.Equals((object)ReadEnumU8AsString(entity), (object)CompiledModelTestBase.EnumU8.Min), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => object.Equals((object)ReadEnumU8AsString(instance), (object)CompiledModelTestBase.EnumU8.Min)); + enumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8 value) => WriteEnumU8AsString(entity, value)); + enumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsString, 78), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[78]); + enumU8AsString.SetPropertyIndexes( + index: 78, + originalValueIndex: 78, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsString.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -2965,6 +4628,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringArray(instance) == null); + enumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, CompiledModelTestBase.EnumU8[] value) => WriteEnumU8AsStringArray(entity, value)); + enumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enumU8AsStringArray, 79), + (InternalEntityEntry entry) => entry.GetCurrentValue(enumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[79]); + enumU8AsStringArray.SetPropertyIndexes( + index: 79, + originalValueIndex: 79, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3017,6 +4701,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8AsStringCollection(instance) == null); + enumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8AsStringCollection(entity, value)); + enumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8AsStringCollection, 80), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[80]); + enumU8AsStringCollection.SetPropertyIndexes( + index: 80, + originalValueIndex: 80, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3069,6 +4774,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("EnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadEnumU8Collection(instance) == null); + enumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List value) => WriteEnumU8Collection(entity, value)); + enumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enumU8Collection, 81), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[81]); + enumU8Collection.SetPropertyIndexes( + index: 81, + originalValueIndex: 81, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enumU8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (CompiledModelTestBase.EnumU8 v1, CompiledModelTestBase.EnumU8 v2) => object.Equals((object)v1, (object)v2), @@ -3124,6 +4850,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Float", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0f); + @float.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloat(entity).Equals(0F), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloat(instance).Equals(0F)); + @float.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float value) => WriteFloat(entity, value)); + @float.SetAccessors( + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@float, 82), + (InternalEntityEntry entry) => entry.GetCurrentValue(@float), + (ValueBuffer valueBuffer) => valueBuffer[82]); + @float.SetPropertyIndexes( + index: 82, + originalValueIndex: 82, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @float.TypeMapping = FloatTypeMapping.Default.Clone( comparer: new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3145,6 +4892,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("FloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + floatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadFloatArray(instance) == null); + floatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, float[] value) => WriteFloatArray(entity, value)); + floatArray.SetAccessors( + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(floatArray, 83), + (InternalEntityEntry entry) => entry.GetCurrentValue(floatArray), + (ValueBuffer valueBuffer) => valueBuffer[83]); + floatArray.SetPropertyIndexes( + index: 83, + originalValueIndex: 83, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); floatArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (float v1, float v2) => v1.Equals(v2), @@ -3184,6 +4952,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Guid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuid(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuid(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuid(entity, value)); + guid.SetAccessors( + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guid, 84), + (InternalEntityEntry entry) => entry.GetCurrentValue(guid), + (ValueBuffer valueBuffer) => valueBuffer[84]); + guid.SetPropertyIndexes( + index: 84, + originalValueIndex: 84, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guid.TypeMapping = SqliteGuidTypeMapping.Default; var guidArray = runtimeEntityType.AddProperty( @@ -3191,6 +4980,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + guidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidArray(instance) == null); + guidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid[] value) => WriteGuidArray(entity, value)); + guidArray.SetAccessors( + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidArray, 85), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidArray), + (ValueBuffer valueBuffer) => valueBuffer[85]); + guidArray.SetPropertyIndexes( + index: 85, + originalValueIndex: 85, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3216,6 +5026,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToBytesConverter()); + guidToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToBytesConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToBytesConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToBytesConverterProperty(entity, value)); + guidToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToBytesConverterProperty, 86), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[86]); + guidToBytesConverterProperty.SetPropertyIndexes( + index: 86, + originalValueIndex: 86, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3226,19 +5057,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Guid v) => v.GetHashCode(), (Guid v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)), + (byte[] v) => new Guid(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (Guid v) => v.ToByteArray(), - (Byte[] v) => new Guid(v)))); + (byte[] v) => new Guid(v)))); guidToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); var guidToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3247,6 +5078,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("GuidToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new GuidToStringConverter()); + guidToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadGuidToStringConverterProperty(entity) == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadGuidToStringConverterProperty(instance) == new Guid("00000000-0000-0000-0000-000000000000")); + guidToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Guid value) => WriteGuidToStringConverterProperty(entity, value)); + guidToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadGuidToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(guidToStringConverterProperty, 87), + (InternalEntityEntry entry) => entry.GetCurrentValue(guidToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[87]); + guidToStringConverterProperty.SetPropertyIndexes( + index: 87, + originalValueIndex: 87, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); guidToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Guid v1, Guid v2) => v1 == v2, @@ -3277,6 +5129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddress(instance) == null); + iPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddress(entity, value)); + iPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddress, 88), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddress), + (ValueBuffer valueBuffer) => valueBuffer[88]); + iPAddress.SetPropertyIndexes( + index: 88, + originalValueIndex: 88, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3306,6 +5179,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + iPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressArray(instance) == null); + iPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteIPAddressArray(entity, value)); + iPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressArray, 89), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[89]); + iPAddressArray.SetPropertyIndexes( + index: 89, + originalValueIndex: 89, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3361,6 +5255,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToBytesConverter()); + iPAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToBytesConverterProperty(instance) == null); + iPAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToBytesConverterProperty(entity, value)); + iPAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToBytesConverterProperty, 90), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[90]); + iPAddressToBytesConverterProperty.SetPropertyIndexes( + index: 90, + originalValueIndex: 90, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3371,19 +5286,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (IPAddress v) => v.GetHashCode(), (IPAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 16), converter: new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)), + (byte[] v) => new IPAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (IPAddress v) => v.GetAddressBytes(), - (Byte[] v) => new IPAddress(v)))); + (byte[] v) => new IPAddress(v)))); var iPAddressToStringConverterProperty = runtimeEntityType.AddProperty( "IPAddressToStringConverterProperty", @@ -3391,6 +5306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IPAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new IPAddressToStringConverter()); + iPAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIPAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIPAddressToStringConverterProperty(instance) == null); + iPAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteIPAddressToStringConverterProperty(entity, value)); + iPAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIPAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(iPAddressToStringConverterProperty, 91), + (InternalEntityEntry entry) => entry.GetCurrentValue(iPAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[91]); + iPAddressToStringConverterProperty.SetPropertyIndexes( + index: 91, + originalValueIndex: 91, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); iPAddressToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -3421,6 +5357,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (short)0); + int16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16(instance) == 0); + int16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short value) => WriteInt16(entity, value)); + int16.SetAccessors( + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16, 92), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16), + (ValueBuffer valueBuffer) => valueBuffer[92]); + int16.SetPropertyIndexes( + index: 92, + originalValueIndex: 92, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (short v1, short v2) => v1 == v2, @@ -3442,6 +5399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt16Array(instance) == null); + int16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, short[] value) => WriteInt16Array(entity, value)); + int16Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int16Array, 93), + (InternalEntityEntry entry) => entry.GetCurrentValue(int16Array), + (ValueBuffer valueBuffer) => valueBuffer[93]); + int16Array.SetPropertyIndexes( + index: 93, + originalValueIndex: 93, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -3481,6 +5459,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + int32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32(instance) == 0); + int32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteInt32(entity, value)); + int32.SetAccessors( + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32, 94), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32), + (ValueBuffer valueBuffer) => valueBuffer[94]); + int32.SetPropertyIndexes( + index: 94, + originalValueIndex: 94, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3502,6 +5501,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt32Array(instance) == null); + int32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int[] value) => WriteInt32Array(entity, value)); + int32Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int32Array, 95), + (InternalEntityEntry entry) => entry.GetCurrentValue(int32Array), + (ValueBuffer valueBuffer) => valueBuffer[95]); + int32Array.SetPropertyIndexes( + index: 95, + originalValueIndex: 95, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3541,6 +5561,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0L); + int64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64(entity) == 0L, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64(instance) == 0L); + int64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long value) => WriteInt64(entity, value)); + int64.SetAccessors( + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64, 96), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64), + (ValueBuffer valueBuffer) => valueBuffer[96]); + int64.SetPropertyIndexes( + index: 96, + originalValueIndex: 96, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -3562,6 +5603,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt64Array(instance) == null); + int64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, long[] value) => WriteInt64Array(entity, value)); + int64Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int64Array, 97), + (InternalEntityEntry entry) => entry.GetCurrentValue(int64Array), + (ValueBuffer valueBuffer) => valueBuffer[97]); + int64Array.SetPropertyIndexes( + index: 97, + originalValueIndex: 97, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (long v1, long v2) => v1 == v2, @@ -3601,6 +5663,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (sbyte)0); + int8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8(instance) == 0); + int8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte value) => WriteInt8(entity, value)); + int8.SetAccessors( + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8, 98), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8), + (ValueBuffer valueBuffer) => valueBuffer[98]); + int8.SetPropertyIndexes( + index: 98, + originalValueIndex: 98, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -3622,6 +5705,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Int8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + int8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadInt8Array(instance) == null); + int8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, sbyte[] value) => WriteInt8Array(entity, value)); + int8Array.SetAccessors( + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(int8Array, 99), + (InternalEntityEntry entry) => entry.GetCurrentValue(int8Array), + (ValueBuffer valueBuffer) => valueBuffer[99]); + int8Array.SetPropertyIndexes( + index: 99, + originalValueIndex: 99, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); int8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (sbyte v1, sbyte v2) => v1 == v2, @@ -3661,6 +5765,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToBytesConverter()); + intNumberToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToBytesConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToBytesConverterProperty(instance) == 0); + intNumberToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToBytesConverterProperty(entity, value)); + intNumberToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToBytesConverterProperty, 100), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[100]); + intNumberToBytesConverterProperty.SetPropertyIndexes( + index: 100, + originalValueIndex: 100, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3671,19 +5796,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v, (int v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 4), converter: new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (int v) => NumberToBytesConverter.ReverseInt(BitConverter.GetBytes(v)), - (Byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); + (byte[] v) => v == null ? 0 : BitConverter.ToInt32(NumberToBytesConverter.ReverseInt(v.Length == 0 ? new byte[4] : v), 0)))); intNumberToBytesConverterProperty.SetSentinelFromProviderValue(new byte[] { 0, 0, 0, 0 }); var intNumberToStringConverterProperty = runtimeEntityType.AddProperty( @@ -3692,6 +5817,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("IntNumberToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new NumberToStringConverter()); + intNumberToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadIntNumberToStringConverterProperty(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadIntNumberToStringConverterProperty(instance) == 0); + intNumberToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, int value) => WriteIntNumberToStringConverterProperty(entity, value)); + intNumberToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadIntNumberToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(intNumberToStringConverterProperty, 101), + (InternalEntityEntry entry) => entry.GetCurrentValue(intNumberToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[101]); + intNumberToStringConverterProperty.SetPropertyIndexes( + index: 101, + originalValueIndex: 101, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); intNumberToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -3724,6 +5870,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true, valueConverter: new CompiledModelTestBase.NullIntToNullStringConverter()); + nullIntToNullStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullIntToNullStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullIntToNullStringConverterProperty(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullIntToNullStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullIntToNullStringConverterProperty(instance).HasValue); + nullIntToNullStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullIntToNullStringConverterProperty(entity, value)); + nullIntToNullStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullIntToNullStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullIntToNullStringConverterProperty, 102), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullIntToNullStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[102]); + nullIntToNullStringConverterProperty.SetPropertyIndexes( + index: 102, + originalValueIndex: 102, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullIntToNullStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1 == v2, @@ -3754,6 +5921,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBool.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBool(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableBool(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBool(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableBool(instance).HasValue); + nullableBool.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableBool(entity, value)); + nullableBool.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBool((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableBool, 103), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableBool), + (ValueBuffer valueBuffer) => valueBuffer[103]); + nullableBool.SetPropertyIndexes( + index: 103, + originalValueIndex: 103, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBool.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -3775,6 +5963,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(bool?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBoolArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBoolArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBoolArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBoolArray(instance) == null); + nullableBoolArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableBoolArray(entity, value)); + nullableBoolArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBoolArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableBoolArray, 104), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableBoolArray), + (ValueBuffer valueBuffer) => valueBuffer[104]); + nullableBoolArray.SetPropertyIndexes( + index: 104, + originalValueIndex: 104, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBoolArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (bool)v1 == (bool)v2 || !v1.HasValue && !v2.HasValue, @@ -3814,34 +6023,76 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableBytes.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytes(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytes(instance) == null); + nullableBytes.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteNullableBytes(entity, value)); + nullableBytes.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytes((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytes, 105), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytes), + (ValueBuffer valueBuffer) => valueBuffer[105]); + nullableBytes.SetPropertyIndexes( + index: 105, + originalValueIndex: 105, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytes.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var nullableBytesArray = runtimeEntityType.AddProperty( "NullableBytesArray", typeof(byte[][]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableBytesArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableBytesArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableBytesArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableBytesArray(instance) == null); + nullableBytesArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[][] value) => WriteNullableBytesArray(entity, value)); + nullableBytesArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableBytesArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableBytesArray, 106), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableBytesArray), + (ValueBuffer valueBuffer) => valueBuffer[106]); + nullableBytesArray.SetPropertyIndexes( + index: 106, + originalValueIndex: 106, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableBytesArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), keyComparer: new ListComparer(new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v)), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v)), providerValueComparer: new ValueComparer( (string v1, string v2) => v1 == v2, (string v) => v.GetHashCode(), @@ -3852,17 +6103,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas SqliteJsonByteArrayReaderWriter.Instance), elementMapping: SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()))); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()))); var nullableChar = runtimeEntityType.AddProperty( "NullableChar", @@ -3870,6 +6121,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableChar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableChar.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableChar(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableChar(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableChar(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableChar(instance).HasValue); + nullableChar.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableChar(entity, value)); + nullableChar.SetAccessors( + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableChar((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableChar, 107), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableChar), + (ValueBuffer valueBuffer) => valueBuffer[107]); + nullableChar.SetPropertyIndexes( + index: 107, + originalValueIndex: 107, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableChar.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -3891,6 +6163,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(char?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableCharArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableCharArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableCharArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableCharArray(instance) == null); + nullableCharArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableCharArray(entity, value)); + nullableCharArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableCharArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableCharArray, 108), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableCharArray), + (ValueBuffer valueBuffer) => valueBuffer[108]); + nullableCharArray.SetPropertyIndexes( + index: 108, + originalValueIndex: 108, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableCharArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (char)v1 == (char)v2 || !v1.HasValue && !v2.HasValue, @@ -3930,6 +6223,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateOnly(instance).HasValue); + nullableDateOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateOnly(entity, value)); + nullableDateOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateOnly, 109), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateOnly), + (ValueBuffer valueBuffer) => valueBuffer[109]); + nullableDateOnly.SetPropertyIndexes( + index: 109, + originalValueIndex: 109, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnly.TypeMapping = SqliteDateOnlyTypeMapping.Default; var nullableDateOnlyArray = runtimeEntityType.AddProperty( @@ -3937,6 +6251,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateOnlyArray(instance) == null); + nullableDateOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateOnlyArray(entity, value)); + nullableDateOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateOnlyArray, 110), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[110]); + nullableDateOnlyArray.SetPropertyIndexes( + index: 110, + originalValueIndex: 110, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateOnly)v1 == (DateOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -3962,6 +6297,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDateTime.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTime(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDateTime(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTime(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDateTime(instance).HasValue); + nullableDateTime.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDateTime(entity, value)); + nullableDateTime.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTime((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDateTime, 111), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDateTime), + (ValueBuffer valueBuffer) => valueBuffer[111]); + nullableDateTime.SetPropertyIndexes( + index: 111, + originalValueIndex: 111, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTime.TypeMapping = SqliteDateTimeTypeMapping.Default; var nullableDateTimeArray = runtimeEntityType.AddProperty( @@ -3969,6 +6325,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(DateTime?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDateTimeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDateTimeArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDateTimeArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDateTimeArray(instance) == null); + nullableDateTimeArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDateTimeArray(entity, value)); + nullableDateTimeArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDateTimeArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDateTimeArray, 112), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDateTimeArray), + (ValueBuffer valueBuffer) => valueBuffer[112]); + nullableDateTimeArray.SetPropertyIndexes( + index: 112, + originalValueIndex: 112, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDateTimeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (DateTime)v1 == (DateTime)v2 || !v1.HasValue && !v2.HasValue, @@ -3994,6 +6371,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDecimal.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimal(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDecimal(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimal(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDecimal(instance).HasValue); + nullableDecimal.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDecimal(entity, value)); + nullableDecimal.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimal((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDecimal, 113), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDecimal), + (ValueBuffer valueBuffer) => valueBuffer[113]); + nullableDecimal.SetPropertyIndexes( + index: 113, + originalValueIndex: 113, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimal.TypeMapping = SqliteDecimalTypeMapping.Default; var nullableDecimalArray = runtimeEntityType.AddProperty( @@ -4001,6 +6399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(decimal?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDecimalArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDecimalArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDecimalArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDecimalArray(instance) == null); + nullableDecimalArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDecimalArray(entity, value)); + nullableDecimalArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDecimalArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDecimalArray, 114), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDecimalArray), + (ValueBuffer valueBuffer) => valueBuffer[114]); + nullableDecimalArray.SetPropertyIndexes( + index: 114, + originalValueIndex: 114, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDecimalArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (decimal)v1 == (decimal)v2 || !v1.HasValue && !v2.HasValue, @@ -4026,6 +6445,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDouble", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableDouble.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDouble(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableDouble(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDouble(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableDouble(instance).HasValue); + nullableDouble.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableDouble(entity, value)); + nullableDouble.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDouble((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableDouble, 115), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableDouble), + (ValueBuffer valueBuffer) => valueBuffer[115]); + nullableDouble.SetPropertyIndexes( + index: 115, + originalValueIndex: 115, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDouble.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4047,6 +6487,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(double?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableDoubleArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableDoubleArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableDoubleArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableDoubleArray(instance) == null); + nullableDoubleArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableDoubleArray(entity, value)); + nullableDoubleArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableDoubleArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableDoubleArray, 116), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableDoubleArray), + (ValueBuffer valueBuffer) => valueBuffer[116]); + nullableDoubleArray.SetPropertyIndexes( + index: 116, + originalValueIndex: 116, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableDoubleArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((double)v1).Equals((double)v2) || !v1.HasValue && !v2.HasValue, @@ -4086,6 +6547,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16(instance).HasValue); + nullableEnum16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16, 117), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16), + (ValueBuffer valueBuffer) => valueBuffer[117]); + nullableEnum16.SetPropertyIndexes( + index: 117, + originalValueIndex: 117, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4115,6 +6597,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Array(instance) == null); + nullableEnum16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16Array(entity, value)); + nullableEnum16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16Array, 118), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16Array), + (ValueBuffer valueBuffer) => valueBuffer[118]); + nullableEnum16Array.SetPropertyIndexes( + index: 118, + originalValueIndex: 118, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4170,6 +6673,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum16AsString(instance).HasValue); + nullableEnum16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum16)value)); + nullableEnum16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum16AsString, 119), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum16AsString), + (ValueBuffer valueBuffer) => valueBuffer[119]); + nullableEnum16AsString.SetPropertyIndexes( + index: 119, + originalValueIndex: 119, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsString.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4199,6 +6723,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringArray(instance) == null); + nullableEnum16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum16AsStringArray(entity, value)); + nullableEnum16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum16AsStringArray, 120), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[120]); + nullableEnum16AsStringArray.SetPropertyIndexes( + index: 120, + originalValueIndex: 120, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4253,6 +6798,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16AsStringCollection(instance) == null); + nullableEnum16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16AsStringCollection(entity, value)); + nullableEnum16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16AsStringCollection, 121), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[121]); + nullableEnum16AsStringCollection.SetPropertyIndexes( + index: 121, + originalValueIndex: 121, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4307,6 +6873,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum16Collection(instance) == null); + nullableEnum16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum16Collection(entity, value)); + nullableEnum16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum16Collection, 122), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum16Collection), + (ValueBuffer valueBuffer) => valueBuffer[122]); + nullableEnum16Collection.SetPropertyIndexes( + index: 122, + originalValueIndex: 122, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum16)v1, (object)(CompiledModelTestBase.Enum16)v2) || !v1.HasValue && !v2.HasValue, @@ -4362,6 +6949,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32(instance).HasValue); + nullableEnum32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32, 123), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32), + (ValueBuffer valueBuffer) => valueBuffer[123]); + nullableEnum32.SetPropertyIndexes( + index: 123, + originalValueIndex: 123, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4391,6 +6999,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Array(instance) == null); + nullableEnum32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32Array(entity, value)); + nullableEnum32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32Array, 124), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32Array), + (ValueBuffer valueBuffer) => valueBuffer[124]); + nullableEnum32Array.SetPropertyIndexes( + index: 124, + originalValueIndex: 124, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4446,6 +7075,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum32AsString(instance).HasValue); + nullableEnum32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum32)value)); + nullableEnum32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum32AsString, 125), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum32AsString), + (ValueBuffer valueBuffer) => valueBuffer[125]); + nullableEnum32AsString.SetPropertyIndexes( + index: 125, + originalValueIndex: 125, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsString.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4475,6 +7125,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringArray(instance) == null); + nullableEnum32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum32AsStringArray(entity, value)); + nullableEnum32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum32AsStringArray, 126), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[126]); + nullableEnum32AsStringArray.SetPropertyIndexes( + index: 126, + originalValueIndex: 126, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4529,6 +7200,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32AsStringCollection(instance) == null); + nullableEnum32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32AsStringCollection(entity, value)); + nullableEnum32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32AsStringCollection, 127), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[127]); + nullableEnum32AsStringCollection.SetPropertyIndexes( + index: 127, + originalValueIndex: 127, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4583,6 +7275,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum32Collection(instance) == null); + nullableEnum32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum32Collection(entity, value)); + nullableEnum32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum32Collection, 128), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum32Collection), + (ValueBuffer valueBuffer) => valueBuffer[128]); + nullableEnum32Collection.SetPropertyIndexes( + index: 128, + originalValueIndex: 128, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum32)v1, (object)(CompiledModelTestBase.Enum32)v2) || !v1.HasValue && !v2.HasValue, @@ -4638,6 +7351,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64(instance).HasValue); + nullableEnum64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64, 129), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64), + (ValueBuffer valueBuffer) => valueBuffer[129]); + nullableEnum64.SetPropertyIndexes( + index: 129, + originalValueIndex: 129, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4667,6 +7401,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Array(instance) == null); + nullableEnum64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64Array(entity, value)); + nullableEnum64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64Array, 130), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64Array), + (ValueBuffer valueBuffer) => valueBuffer[130]); + nullableEnum64Array.SetPropertyIndexes( + index: 130, + originalValueIndex: 130, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4722,6 +7477,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum64AsString(instance).HasValue); + nullableEnum64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum64)value)); + nullableEnum64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum64AsString, 131), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum64AsString), + (ValueBuffer valueBuffer) => valueBuffer[131]); + nullableEnum64AsString.SetPropertyIndexes( + index: 131, + originalValueIndex: 131, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsString.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4751,6 +7527,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringArray(instance) == null); + nullableEnum64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum64AsStringArray(entity, value)); + nullableEnum64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum64AsStringArray, 132), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[132]); + nullableEnum64AsStringArray.SetPropertyIndexes( + index: 132, + originalValueIndex: 132, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4805,6 +7602,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64AsStringCollection(instance) == null); + nullableEnum64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64AsStringCollection(entity, value)); + nullableEnum64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64AsStringCollection, 133), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[133]); + nullableEnum64AsStringCollection.SetPropertyIndexes( + index: 133, + originalValueIndex: 133, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4859,6 +7677,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum64Collection(instance) == null); + nullableEnum64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum64Collection(entity, value)); + nullableEnum64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum64Collection, 134), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum64Collection), + (ValueBuffer valueBuffer) => valueBuffer[134]); + nullableEnum64Collection.SetPropertyIndexes( + index: 134, + originalValueIndex: 134, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum64)v1, (object)(CompiledModelTestBase.Enum64)v2) || !v1.HasValue && !v2.HasValue, @@ -4914,6 +7753,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8(instance).HasValue); + nullableEnum8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8, 135), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8), + (ValueBuffer valueBuffer) => valueBuffer[135]); + nullableEnum8.SetPropertyIndexes( + index: 135, + originalValueIndex: 135, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -4943,6 +7803,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Array(instance) == null); + nullableEnum8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8Array(entity, value)); + nullableEnum8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8Array, 136), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8Array), + (ValueBuffer valueBuffer) => valueBuffer[136]); + nullableEnum8Array.SetPropertyIndexes( + index: 136, + originalValueIndex: 136, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -4998,6 +7879,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnum8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnum8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnum8AsString(instance).HasValue); + nullableEnum8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnum8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.Enum8)value)); + nullableEnum8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnum8AsString, 137), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnum8AsString), + (ValueBuffer valueBuffer) => valueBuffer[137]); + nullableEnum8AsString.SetPropertyIndexes( + index: 137, + originalValueIndex: 137, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsString.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5027,6 +7929,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.Enum8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringArray(instance) == null); + nullableEnum8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnum8AsStringArray(entity, value)); + nullableEnum8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnum8AsStringArray, 138), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnum8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[138]); + nullableEnum8AsStringArray.SetPropertyIndexes( + index: 138, + originalValueIndex: 138, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5081,6 +8004,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8AsStringCollection(instance) == null); + nullableEnum8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8AsStringCollection(entity, value)); + nullableEnum8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8AsStringCollection, 139), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[139]); + nullableEnum8AsStringCollection.SetPropertyIndexes( + index: 139, + originalValueIndex: 139, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5135,6 +8079,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnum8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnum8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnum8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnum8Collection(instance) == null); + nullableEnum8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnum8Collection(entity, value)); + nullableEnum8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnum8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnum8Collection, 140), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnum8Collection), + (ValueBuffer valueBuffer) => valueBuffer[140]); + nullableEnum8Collection.SetPropertyIndexes( + index: 140, + originalValueIndex: 140, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnum8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.Enum8)v1, (object)(CompiledModelTestBase.Enum8)v2) || !v1.HasValue && !v2.HasValue, @@ -5190,6 +8155,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16(instance).HasValue); + nullableEnumU16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16, 141), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16), + (ValueBuffer valueBuffer) => valueBuffer[141]); + nullableEnumU16.SetPropertyIndexes( + index: 141, + originalValueIndex: 141, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5219,6 +8205,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Array(instance) == null); + nullableEnumU16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16Array(entity, value)); + nullableEnumU16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16Array, 142), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16Array), + (ValueBuffer valueBuffer) => valueBuffer[142]); + nullableEnumU16Array.SetPropertyIndexes( + index: 142, + originalValueIndex: 142, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5274,6 +8281,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU16AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU16AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU16AsString(instance).HasValue); + nullableEnumU16AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU16AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU16)value)); + nullableEnumU16AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU16AsString, 143), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU16AsString), + (ValueBuffer valueBuffer) => valueBuffer[143]); + nullableEnumU16AsString.SetPropertyIndexes( + index: 143, + originalValueIndex: 143, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsString.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5303,6 +8331,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU16?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringArray(instance) == null); + nullableEnumU16AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU16AsStringArray(entity, value)); + nullableEnumU16AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU16AsStringArray, 144), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU16AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[144]); + nullableEnumU16AsStringArray.SetPropertyIndexes( + index: 144, + originalValueIndex: 144, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5357,6 +8406,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16AsStringCollection(instance) == null); + nullableEnumU16AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16AsStringCollection(entity, value)); + nullableEnumU16AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16AsStringCollection, 145), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[145]); + nullableEnumU16AsStringCollection.SetPropertyIndexes( + index: 145, + originalValueIndex: 145, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5411,6 +8481,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU16Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU16Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU16Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU16Collection(instance) == null); + nullableEnumU16Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU16Collection(entity, value)); + nullableEnumU16Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU16Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU16Collection, 146), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU16Collection), + (ValueBuffer valueBuffer) => valueBuffer[146]); + nullableEnumU16Collection.SetPropertyIndexes( + index: 146, + originalValueIndex: 146, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU16Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU16)v1, (object)(CompiledModelTestBase.EnumU16)v2) || !v1.HasValue && !v2.HasValue, @@ -5466,6 +8557,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32(instance).HasValue); + nullableEnumU32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32, 147), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32), + (ValueBuffer valueBuffer) => valueBuffer[147]); + nullableEnumU32.SetPropertyIndexes( + index: 147, + originalValueIndex: 147, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5495,6 +8607,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Array(instance) == null); + nullableEnumU32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32Array(entity, value)); + nullableEnumU32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32Array, 148), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32Array), + (ValueBuffer valueBuffer) => valueBuffer[148]); + nullableEnumU32Array.SetPropertyIndexes( + index: 148, + originalValueIndex: 148, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5550,6 +8683,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU32AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU32AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU32AsString(instance).HasValue); + nullableEnumU32AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU32AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU32)value)); + nullableEnumU32AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU32AsString, 149), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU32AsString), + (ValueBuffer valueBuffer) => valueBuffer[149]); + nullableEnumU32AsString.SetPropertyIndexes( + index: 149, + originalValueIndex: 149, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsString.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5579,6 +8733,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU32?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringArray(instance) == null); + nullableEnumU32AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU32AsStringArray(entity, value)); + nullableEnumU32AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU32AsStringArray, 150), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU32AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[150]); + nullableEnumU32AsStringArray.SetPropertyIndexes( + index: 150, + originalValueIndex: 150, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5633,6 +8808,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32AsStringCollection(instance) == null); + nullableEnumU32AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32AsStringCollection(entity, value)); + nullableEnumU32AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32AsStringCollection, 151), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[151]); + nullableEnumU32AsStringCollection.SetPropertyIndexes( + index: 151, + originalValueIndex: 151, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5687,6 +8883,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU32Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU32Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU32Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU32Collection(instance) == null); + nullableEnumU32Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU32Collection(entity, value)); + nullableEnumU32Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU32Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU32Collection, 152), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU32Collection), + (ValueBuffer valueBuffer) => valueBuffer[152]); + nullableEnumU32Collection.SetPropertyIndexes( + index: 152, + originalValueIndex: 152, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU32Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU32)v1, (object)(CompiledModelTestBase.EnumU32)v2) || !v1.HasValue && !v2.HasValue, @@ -5742,6 +8959,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64(instance).HasValue); + nullableEnumU64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64, 153), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64), + (ValueBuffer valueBuffer) => valueBuffer[153]); + nullableEnumU64.SetPropertyIndexes( + index: 153, + originalValueIndex: 153, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5769,6 +9007,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Array(instance) == null); + nullableEnumU64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64Array(entity, value)); + nullableEnumU64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64Array, 154), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64Array), + (ValueBuffer valueBuffer) => valueBuffer[154]); + nullableEnumU64Array.SetPropertyIndexes( + index: 154, + originalValueIndex: 154, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5822,6 +9081,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU64AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU64AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU64AsString(instance).HasValue); + nullableEnumU64AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU64AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU64)value)); + nullableEnumU64AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU64AsString, 155), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU64AsString), + (ValueBuffer valueBuffer) => valueBuffer[155]); + nullableEnumU64AsString.SetPropertyIndexes( + index: 155, + originalValueIndex: 155, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsString.TypeMapping = SqliteULongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5849,6 +9129,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU64?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringArray(instance) == null); + nullableEnumU64AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU64AsStringArray(entity, value)); + nullableEnumU64AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU64AsStringArray, 156), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU64AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[156]); + nullableEnumU64AsStringArray.SetPropertyIndexes( + index: 156, + originalValueIndex: 156, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5901,6 +9202,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64AsStringCollection(instance) == null); + nullableEnumU64AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64AsStringCollection(entity, value)); + nullableEnumU64AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64AsStringCollection, 157), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[157]); + nullableEnumU64AsStringCollection.SetPropertyIndexes( + index: 157, + originalValueIndex: 157, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -5953,6 +9275,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU64Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU64Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU64Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU64Collection(instance) == null); + nullableEnumU64Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU64Collection(entity, value)); + nullableEnumU64Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU64Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU64Collection, 158), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU64Collection), + (ValueBuffer valueBuffer) => valueBuffer[158]); + nullableEnumU64Collection.SetPropertyIndexes( + index: 158, + originalValueIndex: 158, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU64Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU64)v1, (object)(CompiledModelTestBase.EnumU64)v2) || !v1.HasValue && !v2.HasValue, @@ -6006,6 +9349,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8(instance).HasValue); + nullableEnumU8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8, 159), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8), + (ValueBuffer valueBuffer) => valueBuffer[159]); + nullableEnumU8.SetPropertyIndexes( + index: 159, + originalValueIndex: 159, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6035,6 +9399,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Array(instance) == null); + nullableEnumU8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8Array(entity, value)); + nullableEnumU8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8Array, 160), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8Array), + (ValueBuffer valueBuffer) => valueBuffer[160]); + nullableEnumU8Array.SetPropertyIndexes( + index: 160, + originalValueIndex: 160, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6090,6 +9475,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableEnumU8AsString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsString(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableEnumU8AsString(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsString(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableEnumU8AsString(instance).HasValue); + nullableEnumU8AsString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableEnumU8AsString(entity, value == null ? value : (Nullable)(CompiledModelTestBase.EnumU8)value)); + nullableEnumU8AsString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableEnumU8AsString, 161), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableEnumU8AsString), + (ValueBuffer valueBuffer) => valueBuffer[161]); + nullableEnumU8AsString.SetPropertyIndexes( + index: 161, + originalValueIndex: 161, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsString.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6119,6 +9525,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.EnumU8?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringArray(instance) == null); + nullableEnumU8AsStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableEnumU8AsStringArray(entity, value)); + nullableEnumU8AsStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableEnumU8AsStringArray, 162), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableEnumU8AsStringArray), + (ValueBuffer valueBuffer) => valueBuffer[162]); + nullableEnumU8AsStringArray.SetPropertyIndexes( + index: 162, + originalValueIndex: 162, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6173,6 +9600,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8AsStringCollection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8AsStringCollection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8AsStringCollection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8AsStringCollection(instance) == null); + nullableEnumU8AsStringCollection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8AsStringCollection(entity, value)); + nullableEnumU8AsStringCollection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8AsStringCollection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8AsStringCollection, 163), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8AsStringCollection), + (ValueBuffer valueBuffer) => valueBuffer[163]); + nullableEnumU8AsStringCollection.SetPropertyIndexes( + index: 163, + originalValueIndex: 163, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8AsStringCollection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6227,6 +9675,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(List), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableEnumU8Collection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableEnumU8Collection.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableEnumU8Collection(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableEnumU8Collection(instance) == null); + nullableEnumU8Collection.SetSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, List> value) => WriteNullableEnumU8Collection(entity, value)); + nullableEnumU8Collection.SetAccessors( + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableEnumU8Collection((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>>(nullableEnumU8Collection, 164), + (InternalEntityEntry entry) => entry.GetCurrentValue>>(nullableEnumU8Collection), + (ValueBuffer valueBuffer) => valueBuffer[164]); + nullableEnumU8Collection.SetPropertyIndexes( + index: 164, + originalValueIndex: 164, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableEnumU8Collection.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.EnumU8)v1, (object)(CompiledModelTestBase.EnumU8)v2) || !v1.HasValue && !v2.HasValue, @@ -6282,6 +9751,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloat", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableFloat.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloat(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableFloat(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloat(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableFloat(instance).HasValue); + nullableFloat.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableFloat(entity, value)); + nullableFloat.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloat((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableFloat, 165), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableFloat), + (ValueBuffer valueBuffer) => valueBuffer[165]); + nullableFloat.SetPropertyIndexes( + index: 165, + originalValueIndex: 165, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloat.TypeMapping = FloatTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -6303,6 +9793,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(float?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableFloatArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableFloatArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableFloatArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableFloatArray(instance) == null); + nullableFloatArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableFloatArray(entity, value)); + nullableFloatArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableFloatArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableFloatArray, 166), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableFloatArray), + (ValueBuffer valueBuffer) => valueBuffer[166]); + nullableFloatArray.SetPropertyIndexes( + index: 166, + originalValueIndex: 166, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableFloatArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && ((float)v1).Equals((float)v2) || !v1.HasValue && !v2.HasValue, @@ -6342,6 +9853,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableGuid.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuid(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableGuid(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuid(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableGuid(instance).HasValue); + nullableGuid.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableGuid(entity, value)); + nullableGuid.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuid((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableGuid, 167), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableGuid), + (ValueBuffer valueBuffer) => valueBuffer[167]); + nullableGuid.SetPropertyIndexes( + index: 167, + originalValueIndex: 167, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuid.TypeMapping = SqliteGuidTypeMapping.Default; var nullableGuidArray = runtimeEntityType.AddProperty( @@ -6349,6 +9881,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Guid?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableGuidArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableGuidArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableGuidArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableGuidArray(instance) == null); + nullableGuidArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableGuidArray(entity, value)); + nullableGuidArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableGuidArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableGuidArray, 168), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableGuidArray), + (ValueBuffer valueBuffer) => valueBuffer[168]); + nullableGuidArray.SetPropertyIndexes( + index: 168, + originalValueIndex: 168, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableGuidArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (Guid)v1 == (Guid)v2 || !v1.HasValue && !v2.HasValue, @@ -6374,6 +9927,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableIPAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddress(instance) == null); + nullableIPAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress value) => WriteNullableIPAddress(entity, value)); + nullableIPAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddress, 169), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddress), + (ValueBuffer valueBuffer) => valueBuffer[169]); + nullableIPAddress.SetPropertyIndexes( + index: 169, + originalValueIndex: 169, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -6403,6 +9977,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(IPAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableIPAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableIPAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableIPAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableIPAddressArray(instance) == null); + nullableIPAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, IPAddress[] value) => WriteNullableIPAddressArray(entity, value)); + nullableIPAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableIPAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableIPAddressArray, 170), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableIPAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[170]); + nullableIPAddressArray.SetPropertyIndexes( + index: 170, + originalValueIndex: 170, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableIPAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -6458,6 +10053,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt16(instance).HasValue); + nullableInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt16(entity, value)); + nullableInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt16, 171), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt16), + (ValueBuffer valueBuffer) => valueBuffer[171]); + nullableInt16.SetPropertyIndexes( + index: 171, + originalValueIndex: 171, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16.TypeMapping = ShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -6479,6 +10095,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(short?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt16Array(instance) == null); + nullableInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt16Array(entity, value)); + nullableInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt16Array, 172), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[172]); + nullableInt16Array.SetPropertyIndexes( + index: 172, + originalValueIndex: 172, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (short)v1 == (short)v2 || !v1.HasValue && !v2.HasValue, @@ -6518,6 +10155,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt32(instance).HasValue); + nullableInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt32(entity, value)); + nullableInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt32, 173), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt32), + (ValueBuffer valueBuffer) => valueBuffer[173]); + nullableInt32.SetPropertyIndexes( + index: 173, + originalValueIndex: 173, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -6539,6 +10197,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(int?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt32Array(instance) == null); + nullableInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt32Array(entity, value)); + nullableInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt32Array, 174), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[174]); + nullableInt32Array.SetPropertyIndexes( + index: 174, + originalValueIndex: 174, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (int)v1 == (int)v2 || !v1.HasValue && !v2.HasValue, @@ -6578,6 +10257,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt64(instance).HasValue); + nullableInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt64(entity, value)); + nullableInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt64, 175), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt64), + (ValueBuffer valueBuffer) => valueBuffer[175]); + nullableInt64.SetPropertyIndexes( + index: 175, + originalValueIndex: 175, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -6599,6 +10299,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt64Array(instance) == null); + nullableInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt64Array(entity, value)); + nullableInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt64Array, 176), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[176]); + nullableInt64Array.SetPropertyIndexes( + index: 176, + originalValueIndex: 176, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -6638,6 +10359,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableInt8(instance).HasValue); + nullableInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableInt8(entity, value)); + nullableInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableInt8, 177), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableInt8), + (ValueBuffer valueBuffer) => valueBuffer[177]); + nullableInt8.SetPropertyIndexes( + index: 177, + originalValueIndex: 177, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8.TypeMapping = SByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -6659,6 +10401,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(sbyte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableInt8Array(instance) == null); + nullableInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableInt8Array(entity, value)); + nullableInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableInt8Array, 178), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[178]); + nullableInt8Array.SetPropertyIndexes( + index: 178, + originalValueIndex: 178, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableInt8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (sbyte)v1 == (sbyte)v2 || !v1.HasValue && !v2.HasValue, @@ -6698,6 +10461,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullablePhysicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddress(instance) == null); + nullablePhysicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WriteNullablePhysicalAddress(entity, value)); + nullablePhysicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddress, 179), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[179]); + nullablePhysicalAddress.SetPropertyIndexes( + index: 179, + originalValueIndex: 179, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -6727,6 +10511,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullablePhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullablePhysicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullablePhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullablePhysicalAddressArray(instance) == null); + nullablePhysicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WriteNullablePhysicalAddressArray(entity, value)); + nullablePhysicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullablePhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullablePhysicalAddressArray, 180), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullablePhysicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[180]); + nullablePhysicalAddressArray.SetPropertyIndexes( + index: 180, + originalValueIndex: 180, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullablePhysicalAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -6782,6 +10587,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableString", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableString.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableString(instance) == null); + nullableString.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteNullableString(entity, value)); + nullableString.SetAccessors( + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableString, 181), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableString), + (ValueBuffer valueBuffer) => valueBuffer[181]); + nullableString.SetPropertyIndexes( + index: 181, + originalValueIndex: 181, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableString.TypeMapping = SqliteStringTypeMapping.Default; var nullableStringArray = runtimeEntityType.AddProperty( @@ -6789,6 +10615,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableStringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableStringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableStringArray(instance) == null); + nullableStringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteNullableStringArray(entity, value)); + nullableStringArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableStringArray, 182), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableStringArray), + (ValueBuffer valueBuffer) => valueBuffer[182]); + nullableStringArray.SetPropertyIndexes( + index: 182, + originalValueIndex: 182, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableStringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -6814,6 +10661,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeOnly(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeOnly(instance).HasValue); + nullableTimeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeOnly(entity, value)); + nullableTimeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeOnly, 183), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeOnly), + (ValueBuffer valueBuffer) => valueBuffer[183]); + nullableTimeOnly.SetPropertyIndexes( + index: 183, + originalValueIndex: 183, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnly.TypeMapping = SqliteTimeOnlyTypeMapping.Default; var nullableTimeOnlyArray = runtimeEntityType.AddProperty( @@ -6821,6 +10689,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeOnlyArray(instance) == null); + nullableTimeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeOnlyArray(entity, value)); + nullableTimeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeOnlyArray, 184), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[184]); + nullableTimeOnlyArray.SetPropertyIndexes( + index: 184, + originalValueIndex: 184, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeOnly)v1 == (TimeOnly)v2 || !v1.HasValue && !v2.HasValue, @@ -6846,6 +10735,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableTimeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableTimeSpan(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableTimeSpan(instance).HasValue); + nullableTimeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableTimeSpan(entity, value)); + nullableTimeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableTimeSpan, 185), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableTimeSpan), + (ValueBuffer valueBuffer) => valueBuffer[185]); + nullableTimeSpan.SetPropertyIndexes( + index: 185, + originalValueIndex: 185, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpan.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -6867,6 +10777,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableTimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableTimeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableTimeSpanArray(instance) == null); + nullableTimeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableTimeSpanArray(entity, value)); + nullableTimeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableTimeSpanArray, 186), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableTimeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[186]); + nullableTimeSpanArray.SetPropertyIndexes( + index: 186, + originalValueIndex: 186, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableTimeSpanArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (TimeSpan)v1 == (TimeSpan)v2 || !v1.HasValue && !v2.HasValue, @@ -6906,6 +10837,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt16(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt16(instance).HasValue); + nullableUInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt16(entity, value)); + nullableUInt16.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt16, 187), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt16), + (ValueBuffer valueBuffer) => valueBuffer[187]); + nullableUInt16.SetPropertyIndexes( + index: 187, + originalValueIndex: 187, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -6927,6 +10879,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt16Array(instance) == null); + nullableUInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt16Array(entity, value)); + nullableUInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt16Array, 188), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[188]); + nullableUInt16Array.SetPropertyIndexes( + index: 188, + originalValueIndex: 188, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ushort)v1 == (ushort)v2 || !v1.HasValue && !v2.HasValue, @@ -6966,6 +10939,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt32(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt32(instance).HasValue); + nullableUInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt32(entity, value)); + nullableUInt32.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt32, 189), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt32), + (ValueBuffer valueBuffer) => valueBuffer[189]); + nullableUInt32.SetPropertyIndexes( + index: 189, + originalValueIndex: 189, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -6987,6 +10981,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt32Array(instance) == null); + nullableUInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt32Array(entity, value)); + nullableUInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt32Array, 190), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[190]); + nullableUInt32Array.SetPropertyIndexes( + index: 190, + originalValueIndex: 190, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (uint)v1 == (uint)v2 || !v1.HasValue && !v2.HasValue, @@ -7026,6 +11041,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt64(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt64(instance).HasValue); + nullableUInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt64(entity, value)); + nullableUInt64.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt64, 191), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt64), + (ValueBuffer valueBuffer) => valueBuffer[191]); + nullableUInt64.SetPropertyIndexes( + index: 191, + originalValueIndex: 191, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64.TypeMapping = SqliteULongTypeMapping.Default; var nullableUInt64Array = runtimeEntityType.AddProperty( @@ -7033,6 +11069,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt64Array(instance) == null); + nullableUInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt64Array(entity, value)); + nullableUInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt64Array, 192), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[192]); + nullableUInt64Array.SetPropertyIndexes( + index: 192, + originalValueIndex: 192, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (ulong)v1 == (ulong)v2 || !v1.HasValue && !v2.HasValue, @@ -7058,6 +11115,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => !ReadNullableUInt8(entity).HasValue, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => !ReadNullableUInt8(instance).HasValue); + nullableUInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable value) => WriteNullableUInt8(entity, value)); + nullableUInt8.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(nullableUInt8, 193), + (InternalEntityEntry entry) => entry.GetCurrentValue>(nullableUInt8), + (ValueBuffer valueBuffer) => valueBuffer[193]); + nullableUInt8.SetPropertyIndexes( + index: 193, + originalValueIndex: 193, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -7079,6 +11157,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte?[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUInt8Array(instance) == null); + nullableUInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Nullable[] value) => WriteNullableUInt8Array(entity, value)); + nullableUInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue[]>(nullableUInt8Array, 194), + (InternalEntityEntry entry) => entry.GetCurrentValue[]>(nullableUInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[194]); + nullableUInt8Array.SetPropertyIndexes( + index: 194, + originalValueIndex: 194, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUInt8Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new NullableValueTypeListComparer(new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (byte)v1 == (byte)v2 || !v1.HasValue && !v2.HasValue, @@ -7118,6 +11217,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + nullableUri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUri(instance) == null); + nullableUri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteNullableUri(entity, value)); + nullableUri.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUri, 195), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUri), + (ValueBuffer valueBuffer) => valueBuffer[195]); + nullableUri.SetPropertyIndexes( + index: 195, + originalValueIndex: 195, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUri.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -7145,6 +11265,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("NullableUriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + nullableUriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadNullableUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadNullableUriArray(instance) == null); + nullableUriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteNullableUriArray(entity, value)); + nullableUriArray.SetAccessors( + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadNullableUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(nullableUriArray, 196), + (InternalEntityEntry entry) => entry.GetCurrentValue(nullableUriArray), + (ValueBuffer valueBuffer) => valueBuffer[196]); + nullableUriArray.SetPropertyIndexes( + index: 196, + originalValueIndex: 196, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); nullableUriArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -7197,6 +11338,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddress.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddress(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddress(instance) == null); + physicalAddress.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddress(entity, value)); + physicalAddress.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddress((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddress, 197), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddress), + (ValueBuffer valueBuffer) => valueBuffer[197]); + physicalAddress.SetPropertyIndexes( + index: 197, + originalValueIndex: 197, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddress.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7226,6 +11388,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(PhysicalAddress[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + physicalAddressArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressArray(instance) == null); + physicalAddressArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress[] value) => WritePhysicalAddressArray(entity, value)); + physicalAddressArray.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressArray, 198), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressArray), + (ValueBuffer valueBuffer) => valueBuffer[198]); + physicalAddressArray.SetPropertyIndexes( + index: 198, + originalValueIndex: 198, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7281,6 +11464,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToBytesConverter()); + physicalAddressToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToBytesConverterProperty(instance) == null); + physicalAddressToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToBytesConverterProperty(entity, value)); + physicalAddressToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToBytesConverterProperty, 199), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[199]); + physicalAddressToBytesConverterProperty.SetPropertyIndexes( + index: 199, + originalValueIndex: 199, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7291,19 +11495,19 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (PhysicalAddress v) => v.GetHashCode(), (PhysicalAddress v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), mappingInfo: new RelationalTypeMappingInfo( size: 8), converter: new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)), + (byte[] v) => new PhysicalAddress(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (PhysicalAddress v) => v.GetAddressBytes(), - (Byte[] v) => new PhysicalAddress(v)))); + (byte[] v) => new PhysicalAddress(v)))); var physicalAddressToStringConverterProperty = runtimeEntityType.AddProperty( "PhysicalAddressToStringConverterProperty", @@ -7311,6 +11515,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("PhysicalAddressToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new PhysicalAddressToStringConverter()); + physicalAddressToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadPhysicalAddressToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadPhysicalAddressToStringConverterProperty(instance) == null); + physicalAddressToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, PhysicalAddress value) => WritePhysicalAddressToStringConverterProperty(entity, value)); + physicalAddressToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadPhysicalAddressToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(physicalAddressToStringConverterProperty, 200), + (InternalEntityEntry entry) => entry.GetCurrentValue(physicalAddressToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[200]); + physicalAddressToStringConverterProperty.SetPropertyIndexes( + index: 200, + originalValueIndex: 200, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); physicalAddressToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (PhysicalAddress v1, PhysicalAddress v2) => object.Equals(v1, v2), @@ -7340,6 +11565,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("String", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + @string.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadString(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadString(instance) == null); + @string.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteString(entity, value)); + @string.SetAccessors( + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadString((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(@string, 201), + (InternalEntityEntry entry) => entry.GetCurrentValue(@string), + (ValueBuffer valueBuffer) => valueBuffer[201]); + @string.SetPropertyIndexes( + index: 201, + originalValueIndex: 201, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); @string.TypeMapping = SqliteStringTypeMapping.Default; var stringArray = runtimeEntityType.AddProperty( @@ -7347,6 +11593,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringArray(instance) == null); + stringArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string[] value) => WriteStringArray(entity, value)); + stringArray.SetAccessors( + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringArray, 202), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringArray), + (ValueBuffer valueBuffer) => valueBuffer[202]); + stringArray.SetPropertyIndexes( + index: 202, + originalValueIndex: 202, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7372,6 +11639,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBoolConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToBoolConverter()); + stringToBoolConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBoolConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBoolConverterProperty(instance) == null); + stringToBoolConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBoolConverterProperty(entity, value)); + stringToBoolConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBoolConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBoolConverterProperty, 203), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBoolConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[203]); + stringToBoolConverterProperty.SetPropertyIndexes( + index: 203, + originalValueIndex: 203, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBoolConverterProperty.TypeMapping = BoolTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7402,6 +11690,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToBytesConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + stringToBytesConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToBytesConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToBytesConverterProperty(instance) == null); + stringToBytesConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToBytesConverterProperty(entity, value)); + stringToBytesConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToBytesConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToBytesConverterProperty, 204), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToBytesConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[204]); + stringToBytesConverterProperty.SetPropertyIndexes( + index: 204, + originalValueIndex: 204, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToBytesConverterProperty.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7412,17 +11721,17 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (string v) => v.GetHashCode(), (string v) => v), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), converter: new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)), + (byte[] v) => Encoding.UTF32.GetString(v)), jsonValueReaderWriter: new JsonConvertedValueReaderWriter( SqliteJsonByteArrayReaderWriter.Instance, new ValueConverter( (string v) => Encoding.UTF32.GetBytes(v), - (Byte[] v) => Encoding.UTF32.GetString(v)))); + (byte[] v) => Encoding.UTF32.GetString(v)))); var stringToCharConverterProperty = runtimeEntityType.AddProperty( "StringToCharConverterProperty", @@ -7430,6 +11739,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToCharConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToCharConverter()); + stringToCharConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToCharConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToCharConverterProperty(instance) == null); + stringToCharConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToCharConverterProperty(entity, value)); + stringToCharConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToCharConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToCharConverterProperty, 205), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToCharConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[205]); + stringToCharConverterProperty.SetPropertyIndexes( + index: 205, + originalValueIndex: 205, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToCharConverterProperty.TypeMapping = CharTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7461,6 +11791,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateOnlyConverter()); + stringToDateOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateOnlyConverterProperty(instance) == null); + stringToDateOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateOnlyConverterProperty(entity, value)); + stringToDateOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateOnlyConverterProperty, 206), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[206]); + stringToDateOnlyConverterProperty.SetPropertyIndexes( + index: 206, + originalValueIndex: 206, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateOnlyConverterProperty.TypeMapping = SqliteDateOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7491,6 +11842,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeConverter()); + stringToDateTimeConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeConverterProperty(instance) == null); + stringToDateTimeConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeConverterProperty(entity, value)); + stringToDateTimeConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeConverterProperty, 207), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[207]); + stringToDateTimeConverterProperty.SetPropertyIndexes( + index: 207, + originalValueIndex: 207, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeConverterProperty.TypeMapping = SqliteDateTimeTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7521,6 +11893,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDateTimeOffsetConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToDateTimeOffsetConverter()); + stringToDateTimeOffsetConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDateTimeOffsetConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDateTimeOffsetConverterProperty(instance) == null); + stringToDateTimeOffsetConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDateTimeOffsetConverterProperty(entity, value)); + stringToDateTimeOffsetConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDateTimeOffsetConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDateTimeOffsetConverterProperty, 208), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDateTimeOffsetConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[208]); + stringToDateTimeOffsetConverterProperty.SetPropertyIndexes( + index: 208, + originalValueIndex: 208, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDateTimeOffsetConverterProperty.TypeMapping = SqliteDateTimeOffsetTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7551,6 +11944,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDecimalNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDecimalNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDecimalNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDecimalNumberConverterProperty(instance) == null); + stringToDecimalNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDecimalNumberConverterProperty(entity, value)); + stringToDecimalNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDecimalNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDecimalNumberConverterProperty, 209), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDecimalNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[209]); + stringToDecimalNumberConverterProperty.SetPropertyIndexes( + index: 209, + originalValueIndex: 209, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDecimalNumberConverterProperty.TypeMapping = SqliteDecimalTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7581,6 +11995,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToDoubleNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToDoubleNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToDoubleNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToDoubleNumberConverterProperty(instance) == null); + stringToDoubleNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToDoubleNumberConverterProperty(entity, value)); + stringToDoubleNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToDoubleNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToDoubleNumberConverterProperty, 210), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToDoubleNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[210]); + stringToDoubleNumberConverterProperty.SetPropertyIndexes( + index: 210, + originalValueIndex: 210, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToDoubleNumberConverterProperty.TypeMapping = DoubleTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7612,6 +12047,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToEnumConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToEnumConverter()); + stringToEnumConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToEnumConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToEnumConverterProperty(instance) == null); + stringToEnumConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToEnumConverterProperty(entity, value)); + stringToEnumConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToEnumConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToEnumConverterProperty, 211), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToEnumConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[211]); + stringToEnumConverterProperty.SetPropertyIndexes( + index: 211, + originalValueIndex: 211, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToEnumConverterProperty.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7641,6 +12097,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(string), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToGuidConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + stringToGuidConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToGuidConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToGuidConverterProperty(instance) == null); + stringToGuidConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToGuidConverterProperty(entity, value)); + stringToGuidConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToGuidConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToGuidConverterProperty, 212), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToGuidConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[212]); + stringToGuidConverterProperty.SetPropertyIndexes( + index: 212, + originalValueIndex: 212, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToGuidConverterProperty.TypeMapping = SqliteStringTypeMapping.Default; var stringToIntNumberConverterProperty = runtimeEntityType.AddProperty( @@ -7649,6 +12126,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToIntNumberConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToNumberConverter()); + stringToIntNumberConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToIntNumberConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToIntNumberConverterProperty(instance) == null); + stringToIntNumberConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToIntNumberConverterProperty(entity, value)); + stringToIntNumberConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToIntNumberConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToIntNumberConverterProperty, 213), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToIntNumberConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[213]); + stringToIntNumberConverterProperty.SetPropertyIndexes( + index: 213, + originalValueIndex: 213, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToIntNumberConverterProperty.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7680,6 +12178,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeOnlyConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeOnlyConverter()); + stringToTimeOnlyConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeOnlyConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeOnlyConverterProperty(instance) == null); + stringToTimeOnlyConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeOnlyConverterProperty(entity, value)); + stringToTimeOnlyConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeOnlyConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeOnlyConverterProperty, 214), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeOnlyConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[214]); + stringToTimeOnlyConverterProperty.SetPropertyIndexes( + index: 214, + originalValueIndex: 214, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeOnlyConverterProperty.TypeMapping = SqliteTimeOnlyTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7710,6 +12229,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToTimeSpanConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToTimeSpanConverter()); + stringToTimeSpanConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToTimeSpanConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToTimeSpanConverterProperty(instance) == null); + stringToTimeSpanConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToTimeSpanConverterProperty(entity, value)); + stringToTimeSpanConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToTimeSpanConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToTimeSpanConverterProperty, 215), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToTimeSpanConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[215]); + stringToTimeSpanConverterProperty.SetPropertyIndexes( + index: 215, + originalValueIndex: 215, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToTimeSpanConverterProperty.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7741,6 +12281,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("StringToUriConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new StringToUriConverter()); + stringToUriConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadStringToUriConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadStringToUriConverterProperty(instance) == null); + stringToUriConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, string value) => WriteStringToUriConverterProperty(entity, value)); + stringToUriConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadStringToUriConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(stringToUriConverterProperty, 216), + (InternalEntityEntry entry) => entry.GetCurrentValue(stringToUriConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[216]); + stringToUriConverterProperty.SetPropertyIndexes( + index: 216, + originalValueIndex: 216, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); stringToUriConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (string v1, string v2) => v1 == v2, @@ -7769,6 +12330,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnly", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeOnly(0, 0, 0)); + timeOnly.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnly(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnly(instance) == default(TimeOnly)); + timeOnly.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnly(entity, value)); + timeOnly.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnly((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnly, 217), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnly), + (ValueBuffer valueBuffer) => valueBuffer[217]); + timeOnly.SetPropertyIndexes( + index: 217, + originalValueIndex: 217, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnly.TypeMapping = SqliteTimeOnlyTypeMapping.Default; var timeOnlyArray = runtimeEntityType.AddProperty( @@ -7776,6 +12358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeOnly[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeOnlyArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyArray(instance) == null); + timeOnlyArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly[] value) => WriteTimeOnlyArray(entity, value)); + timeOnlyArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyArray, 218), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyArray), + (ValueBuffer valueBuffer) => valueBuffer[218]); + timeOnlyArray.SetPropertyIndexes( + index: 218, + originalValueIndex: 218, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7801,6 +12404,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToStringConverter()); + timeOnlyToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToStringConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToStringConverterProperty(instance) == default(TimeOnly)); + timeOnlyToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToStringConverterProperty(entity, value)); + timeOnlyToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToStringConverterProperty, 219), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[219]); + timeOnlyToStringConverterProperty.SetPropertyIndexes( + index: 219, + originalValueIndex: 219, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7832,6 +12456,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeOnlyToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeOnlyToTicksConverter()); + timeOnlyToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeOnlyToTicksConverterProperty(entity) == default(TimeOnly), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeOnlyToTicksConverterProperty(instance) == default(TimeOnly)); + timeOnlyToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeOnly value) => WriteTimeOnlyToTicksConverterProperty(entity, value)); + timeOnlyToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeOnlyToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeOnlyToTicksConverterProperty, 220), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeOnlyToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[220]); + timeOnlyToTicksConverterProperty.SetPropertyIndexes( + index: 220, + originalValueIndex: 220, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeOnlyToTicksConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeOnly v1, TimeOnly v2) => v1.Equals(v2), @@ -7863,6 +12508,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpan", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: new TimeSpan(0, 0, 0, 0, 0)); + timeSpan.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpan(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpan(instance) == default(TimeSpan)); + timeSpan.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpan(entity, value)); + timeSpan.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpan((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpan, 221), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpan), + (ValueBuffer valueBuffer) => valueBuffer[221]); + timeSpan.SetPropertyIndexes( + index: 221, + originalValueIndex: 221, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpan.TypeMapping = TimeSpanTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7884,6 +12550,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(TimeSpan[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + timeSpanArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanArray(instance) == null); + timeSpanArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan[] value) => WriteTimeSpanArray(entity, value)); + timeSpanArray.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanArray, 222), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanArray), + (ValueBuffer valueBuffer) => valueBuffer[222]); + timeSpanArray.SetPropertyIndexes( + index: 222, + originalValueIndex: 222, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7923,6 +12610,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToStringConverter()); + timeSpanToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToStringConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToStringConverterProperty(instance) == default(TimeSpan)); + timeSpanToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToStringConverterProperty(entity, value)); + timeSpanToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToStringConverterProperty, 223), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[223]); + timeSpanToStringConverterProperty.SetPropertyIndexes( + index: 223, + originalValueIndex: 223, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7954,6 +12662,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("TimeSpanToTicksConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new TimeSpanToTicksConverter()); + timeSpanToTicksConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadTimeSpanToTicksConverterProperty(entity) == default(TimeSpan), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadTimeSpanToTicksConverterProperty(instance) == default(TimeSpan)); + timeSpanToTicksConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, TimeSpan value) => WriteTimeSpanToTicksConverterProperty(entity, value)); + timeSpanToTicksConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadTimeSpanToTicksConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(timeSpanToTicksConverterProperty, 224), + (InternalEntityEntry entry) => entry.GetCurrentValue(timeSpanToTicksConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[224]); + timeSpanToTicksConverterProperty.SetPropertyIndexes( + index: 224, + originalValueIndex: 224, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); timeSpanToTicksConverterProperty.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (TimeSpan v1, TimeSpan v2) => v1.Equals(v2), @@ -7985,6 +12714,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (ushort)0); + uInt16.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16(instance) == 0); + uInt16.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort value) => WriteUInt16(entity, value)); + uInt16.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16, 225), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16), + (ValueBuffer valueBuffer) => valueBuffer[225]); + uInt16.SetPropertyIndexes( + index: 225, + originalValueIndex: 225, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16.TypeMapping = UShortTypeMapping.Default.Clone( comparer: new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -8006,6 +12756,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ushort[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt16Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt16Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt16Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt16Array(instance) == null); + uInt16Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ushort[] value) => WriteUInt16Array(entity, value)); + uInt16Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt16Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt16Array, 226), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt16Array), + (ValueBuffer valueBuffer) => valueBuffer[226]); + uInt16Array.SetPropertyIndexes( + index: 226, + originalValueIndex: 226, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt16Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ushort v1, ushort v2) => v1 == v2, @@ -8045,6 +12816,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0u); + uInt32.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32(entity) == 0U, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32(instance) == 0U); + uInt32.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint value) => WriteUInt32(entity, value)); + uInt32.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32, 227), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32), + (ValueBuffer valueBuffer) => valueBuffer[227]); + uInt32.SetPropertyIndexes( + index: 227, + originalValueIndex: 227, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32.TypeMapping = UIntTypeMapping.Default.Clone( comparer: new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -8066,6 +12858,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(uint[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt32Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt32Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt32Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt32Array(instance) == null); + uInt32Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, uint[] value) => WriteUInt32Array(entity, value)); + uInt32Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt32Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt32Array, 228), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt32Array), + (ValueBuffer valueBuffer) => valueBuffer[228]); + uInt32Array.SetPropertyIndexes( + index: 228, + originalValueIndex: 228, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt32Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (uint v1, uint v2) => v1 == v2, @@ -8105,6 +12918,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0ul); + uInt64.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64(entity) == 0UL, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64(instance) == 0UL); + uInt64.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong value) => WriteUInt64(entity, value)); + uInt64.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64, 229), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64), + (ValueBuffer valueBuffer) => valueBuffer[229]); + uInt64.SetPropertyIndexes( + index: 229, + originalValueIndex: 229, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64.TypeMapping = SqliteULongTypeMapping.Default; var uInt64Array = runtimeEntityType.AddProperty( @@ -8112,6 +12946,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(ulong[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt64Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt64Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt64Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt64Array(instance) == null); + uInt64Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, ulong[] value) => WriteUInt64Array(entity, value)); + uInt64Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt64Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt64Array, 230), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt64Array), + (ValueBuffer valueBuffer) => valueBuffer[230]); + uInt64Array.SetPropertyIndexes( + index: 230, + originalValueIndex: 230, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt64Array.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (ulong v1, ulong v2) => v1 == v2, @@ -8137,6 +12992,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: (byte)0); + uInt8.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8(entity) == 0, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8(instance) == 0); + uInt8.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte value) => WriteUInt8(entity, value)); + uInt8.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8, 231), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8), + (ValueBuffer valueBuffer) => valueBuffer[231]); + uInt8.SetPropertyIndexes( + index: 231, + originalValueIndex: 231, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8.TypeMapping = ByteTypeMapping.Default.Clone( comparer: new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -8158,25 +13034,67 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(byte[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UInt8Array", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uInt8Array.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUInt8Array(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUInt8Array(instance) == null); + uInt8Array.SetSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, byte[] value) => WriteUInt8Array(entity, value)); + uInt8Array.SetAccessors( + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUInt8Array((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uInt8Array, 232), + (InternalEntityEntry entry) => entry.GetCurrentValue(uInt8Array), + (ValueBuffer valueBuffer) => valueBuffer[232]); + uInt8Array.SetPropertyIndexes( + index: 232, + originalValueIndex: 232, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uInt8Array.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var uri = runtimeEntityType.AddProperty( "Uri", typeof(Uri), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("Uri", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uri.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUri(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUri(instance) == null); + uri.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUri(entity, value)); + uri.SetAccessors( + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUri((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uri, 233), + (InternalEntityEntry entry) => entry.GetCurrentValue(uri), + (ValueBuffer valueBuffer) => valueBuffer[233]); + uri.SetPropertyIndexes( + index: 233, + originalValueIndex: 233, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uri.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8204,6 +13122,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(Uri[]), propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + uriArray.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriArray(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriArray(instance) == null); + uriArray.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri[] value) => WriteUriArray(entity, value)); + uriArray.SetAccessors( + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriArray((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriArray, 234), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriArray), + (ValueBuffer valueBuffer) => valueBuffer[234]); + uriArray.SetPropertyIndexes( + index: 234, + originalValueIndex: 234, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8257,6 +13196,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.ManyTypes).GetProperty("UriToStringConverterProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.ManyTypes).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), valueConverter: new UriToStringConverter()); + uriToStringConverterProperty.SetGetter( + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity), + (CompiledModelTestBase.ManyTypes entity) => ReadUriToStringConverterProperty(entity) == null, + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance), + (CompiledModelTestBase.ManyTypes instance) => ReadUriToStringConverterProperty(instance) == null); + uriToStringConverterProperty.SetSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetMaterializationSetter( + (CompiledModelTestBase.ManyTypes entity, Uri value) => WriteUriToStringConverterProperty(entity, value)); + uriToStringConverterProperty.SetAccessors( + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => ReadUriToStringConverterProperty((CompiledModelTestBase.ManyTypes)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(uriToStringConverterProperty, 235), + (InternalEntityEntry entry) => entry.GetCurrentValue(uriToStringConverterProperty), + (ValueBuffer valueBuffer) => valueBuffer[235]); + uriToStringConverterProperty.SetPropertyIndexes( + index: 235, + originalValueIndex: 235, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); uriToStringConverterProperty.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ValueComparer( (Uri v1, Uri v2) => v1 == v2, @@ -8288,6 +13248,284 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var @bool = runtimeEntityType.FindProperty("Bool")!; + var boolArray = runtimeEntityType.FindProperty("BoolArray")!; + var boolToStringConverterProperty = runtimeEntityType.FindProperty("BoolToStringConverterProperty")!; + var boolToTwoValuesConverterProperty = runtimeEntityType.FindProperty("BoolToTwoValuesConverterProperty")!; + var boolToZeroOneConverterProperty = runtimeEntityType.FindProperty("BoolToZeroOneConverterProperty")!; + var bytes = runtimeEntityType.FindProperty("Bytes")!; + var bytesArray = runtimeEntityType.FindProperty("BytesArray")!; + var bytesToStringConverterProperty = runtimeEntityType.FindProperty("BytesToStringConverterProperty")!; + var castingConverterProperty = runtimeEntityType.FindProperty("CastingConverterProperty")!; + var @char = runtimeEntityType.FindProperty("Char")!; + var charArray = runtimeEntityType.FindProperty("CharArray")!; + var charToStringConverterProperty = runtimeEntityType.FindProperty("CharToStringConverterProperty")!; + var dateOnly = runtimeEntityType.FindProperty("DateOnly")!; + var dateOnlyArray = runtimeEntityType.FindProperty("DateOnlyArray")!; + var dateOnlyToStringConverterProperty = runtimeEntityType.FindProperty("DateOnlyToStringConverterProperty")!; + var dateTime = runtimeEntityType.FindProperty("DateTime")!; + var dateTimeArray = runtimeEntityType.FindProperty("DateTimeArray")!; + var dateTimeOffsetToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBinaryConverterProperty")!; + var dateTimeOffsetToBytesConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToBytesConverterProperty")!; + var dateTimeOffsetToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeOffsetToStringConverterProperty")!; + var dateTimeToBinaryConverterProperty = runtimeEntityType.FindProperty("DateTimeToBinaryConverterProperty")!; + var dateTimeToStringConverterProperty = runtimeEntityType.FindProperty("DateTimeToStringConverterProperty")!; + var dateTimeToTicksConverterProperty = runtimeEntityType.FindProperty("DateTimeToTicksConverterProperty")!; + var @decimal = runtimeEntityType.FindProperty("Decimal")!; + var decimalArray = runtimeEntityType.FindProperty("DecimalArray")!; + var decimalNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToBytesConverterProperty")!; + var decimalNumberToStringConverterProperty = runtimeEntityType.FindProperty("DecimalNumberToStringConverterProperty")!; + var @double = runtimeEntityType.FindProperty("Double")!; + var doubleArray = runtimeEntityType.FindProperty("DoubleArray")!; + var doubleNumberToBytesConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToBytesConverterProperty")!; + var doubleNumberToStringConverterProperty = runtimeEntityType.FindProperty("DoubleNumberToStringConverterProperty")!; + var enum16 = runtimeEntityType.FindProperty("Enum16")!; + var enum16Array = runtimeEntityType.FindProperty("Enum16Array")!; + var enum16AsString = runtimeEntityType.FindProperty("Enum16AsString")!; + var enum16AsStringArray = runtimeEntityType.FindProperty("Enum16AsStringArray")!; + var enum16AsStringCollection = runtimeEntityType.FindProperty("Enum16AsStringCollection")!; + var enum16Collection = runtimeEntityType.FindProperty("Enum16Collection")!; + var enum32 = runtimeEntityType.FindProperty("Enum32")!; + var enum32Array = runtimeEntityType.FindProperty("Enum32Array")!; + var enum32AsString = runtimeEntityType.FindProperty("Enum32AsString")!; + var enum32AsStringArray = runtimeEntityType.FindProperty("Enum32AsStringArray")!; + var enum32AsStringCollection = runtimeEntityType.FindProperty("Enum32AsStringCollection")!; + var enum32Collection = runtimeEntityType.FindProperty("Enum32Collection")!; + var enum64 = runtimeEntityType.FindProperty("Enum64")!; + var enum64Array = runtimeEntityType.FindProperty("Enum64Array")!; + var enum64AsString = runtimeEntityType.FindProperty("Enum64AsString")!; + var enum64AsStringArray = runtimeEntityType.FindProperty("Enum64AsStringArray")!; + var enum64AsStringCollection = runtimeEntityType.FindProperty("Enum64AsStringCollection")!; + var enum64Collection = runtimeEntityType.FindProperty("Enum64Collection")!; + var enum8 = runtimeEntityType.FindProperty("Enum8")!; + var enum8Array = runtimeEntityType.FindProperty("Enum8Array")!; + var enum8AsString = runtimeEntityType.FindProperty("Enum8AsString")!; + var enum8AsStringArray = runtimeEntityType.FindProperty("Enum8AsStringArray")!; + var enum8AsStringCollection = runtimeEntityType.FindProperty("Enum8AsStringCollection")!; + var enum8Collection = runtimeEntityType.FindProperty("Enum8Collection")!; + var enumToNumberConverterProperty = runtimeEntityType.FindProperty("EnumToNumberConverterProperty")!; + var enumToStringConverterProperty = runtimeEntityType.FindProperty("EnumToStringConverterProperty")!; + var enumU16 = runtimeEntityType.FindProperty("EnumU16")!; + var enumU16Array = runtimeEntityType.FindProperty("EnumU16Array")!; + var enumU16AsString = runtimeEntityType.FindProperty("EnumU16AsString")!; + var enumU16AsStringArray = runtimeEntityType.FindProperty("EnumU16AsStringArray")!; + var enumU16AsStringCollection = runtimeEntityType.FindProperty("EnumU16AsStringCollection")!; + var enumU16Collection = runtimeEntityType.FindProperty("EnumU16Collection")!; + var enumU32 = runtimeEntityType.FindProperty("EnumU32")!; + var enumU32Array = runtimeEntityType.FindProperty("EnumU32Array")!; + var enumU32AsString = runtimeEntityType.FindProperty("EnumU32AsString")!; + var enumU32AsStringArray = runtimeEntityType.FindProperty("EnumU32AsStringArray")!; + var enumU32AsStringCollection = runtimeEntityType.FindProperty("EnumU32AsStringCollection")!; + var enumU32Collection = runtimeEntityType.FindProperty("EnumU32Collection")!; + var enumU64 = runtimeEntityType.FindProperty("EnumU64")!; + var enumU64Array = runtimeEntityType.FindProperty("EnumU64Array")!; + var enumU64AsString = runtimeEntityType.FindProperty("EnumU64AsString")!; + var enumU64AsStringArray = runtimeEntityType.FindProperty("EnumU64AsStringArray")!; + var enumU64AsStringCollection = runtimeEntityType.FindProperty("EnumU64AsStringCollection")!; + var enumU64Collection = runtimeEntityType.FindProperty("EnumU64Collection")!; + var enumU8 = runtimeEntityType.FindProperty("EnumU8")!; + var enumU8Array = runtimeEntityType.FindProperty("EnumU8Array")!; + var enumU8AsString = runtimeEntityType.FindProperty("EnumU8AsString")!; + var enumU8AsStringArray = runtimeEntityType.FindProperty("EnumU8AsStringArray")!; + var enumU8AsStringCollection = runtimeEntityType.FindProperty("EnumU8AsStringCollection")!; + var enumU8Collection = runtimeEntityType.FindProperty("EnumU8Collection")!; + var @float = runtimeEntityType.FindProperty("Float")!; + var floatArray = runtimeEntityType.FindProperty("FloatArray")!; + var guid = runtimeEntityType.FindProperty("Guid")!; + var guidArray = runtimeEntityType.FindProperty("GuidArray")!; + var guidToBytesConverterProperty = runtimeEntityType.FindProperty("GuidToBytesConverterProperty")!; + var guidToStringConverterProperty = runtimeEntityType.FindProperty("GuidToStringConverterProperty")!; + var iPAddress = runtimeEntityType.FindProperty("IPAddress")!; + var iPAddressArray = runtimeEntityType.FindProperty("IPAddressArray")!; + var iPAddressToBytesConverterProperty = runtimeEntityType.FindProperty("IPAddressToBytesConverterProperty")!; + var iPAddressToStringConverterProperty = runtimeEntityType.FindProperty("IPAddressToStringConverterProperty")!; + var int16 = runtimeEntityType.FindProperty("Int16")!; + var int16Array = runtimeEntityType.FindProperty("Int16Array")!; + var int32 = runtimeEntityType.FindProperty("Int32")!; + var int32Array = runtimeEntityType.FindProperty("Int32Array")!; + var int64 = runtimeEntityType.FindProperty("Int64")!; + var int64Array = runtimeEntityType.FindProperty("Int64Array")!; + var int8 = runtimeEntityType.FindProperty("Int8")!; + var int8Array = runtimeEntityType.FindProperty("Int8Array")!; + var intNumberToBytesConverterProperty = runtimeEntityType.FindProperty("IntNumberToBytesConverterProperty")!; + var intNumberToStringConverterProperty = runtimeEntityType.FindProperty("IntNumberToStringConverterProperty")!; + var nullIntToNullStringConverterProperty = runtimeEntityType.FindProperty("NullIntToNullStringConverterProperty")!; + var nullableBool = runtimeEntityType.FindProperty("NullableBool")!; + var nullableBoolArray = runtimeEntityType.FindProperty("NullableBoolArray")!; + var nullableBytes = runtimeEntityType.FindProperty("NullableBytes")!; + var nullableBytesArray = runtimeEntityType.FindProperty("NullableBytesArray")!; + var nullableChar = runtimeEntityType.FindProperty("NullableChar")!; + var nullableCharArray = runtimeEntityType.FindProperty("NullableCharArray")!; + var nullableDateOnly = runtimeEntityType.FindProperty("NullableDateOnly")!; + var nullableDateOnlyArray = runtimeEntityType.FindProperty("NullableDateOnlyArray")!; + var nullableDateTime = runtimeEntityType.FindProperty("NullableDateTime")!; + var nullableDateTimeArray = runtimeEntityType.FindProperty("NullableDateTimeArray")!; + var nullableDecimal = runtimeEntityType.FindProperty("NullableDecimal")!; + var nullableDecimalArray = runtimeEntityType.FindProperty("NullableDecimalArray")!; + var nullableDouble = runtimeEntityType.FindProperty("NullableDouble")!; + var nullableDoubleArray = runtimeEntityType.FindProperty("NullableDoubleArray")!; + var nullableEnum16 = runtimeEntityType.FindProperty("NullableEnum16")!; + var nullableEnum16Array = runtimeEntityType.FindProperty("NullableEnum16Array")!; + var nullableEnum16AsString = runtimeEntityType.FindProperty("NullableEnum16AsString")!; + var nullableEnum16AsStringArray = runtimeEntityType.FindProperty("NullableEnum16AsStringArray")!; + var nullableEnum16AsStringCollection = runtimeEntityType.FindProperty("NullableEnum16AsStringCollection")!; + var nullableEnum16Collection = runtimeEntityType.FindProperty("NullableEnum16Collection")!; + var nullableEnum32 = runtimeEntityType.FindProperty("NullableEnum32")!; + var nullableEnum32Array = runtimeEntityType.FindProperty("NullableEnum32Array")!; + var nullableEnum32AsString = runtimeEntityType.FindProperty("NullableEnum32AsString")!; + var nullableEnum32AsStringArray = runtimeEntityType.FindProperty("NullableEnum32AsStringArray")!; + var nullableEnum32AsStringCollection = runtimeEntityType.FindProperty("NullableEnum32AsStringCollection")!; + var nullableEnum32Collection = runtimeEntityType.FindProperty("NullableEnum32Collection")!; + var nullableEnum64 = runtimeEntityType.FindProperty("NullableEnum64")!; + var nullableEnum64Array = runtimeEntityType.FindProperty("NullableEnum64Array")!; + var nullableEnum64AsString = runtimeEntityType.FindProperty("NullableEnum64AsString")!; + var nullableEnum64AsStringArray = runtimeEntityType.FindProperty("NullableEnum64AsStringArray")!; + var nullableEnum64AsStringCollection = runtimeEntityType.FindProperty("NullableEnum64AsStringCollection")!; + var nullableEnum64Collection = runtimeEntityType.FindProperty("NullableEnum64Collection")!; + var nullableEnum8 = runtimeEntityType.FindProperty("NullableEnum8")!; + var nullableEnum8Array = runtimeEntityType.FindProperty("NullableEnum8Array")!; + var nullableEnum8AsString = runtimeEntityType.FindProperty("NullableEnum8AsString")!; + var nullableEnum8AsStringArray = runtimeEntityType.FindProperty("NullableEnum8AsStringArray")!; + var nullableEnum8AsStringCollection = runtimeEntityType.FindProperty("NullableEnum8AsStringCollection")!; + var nullableEnum8Collection = runtimeEntityType.FindProperty("NullableEnum8Collection")!; + var nullableEnumU16 = runtimeEntityType.FindProperty("NullableEnumU16")!; + var nullableEnumU16Array = runtimeEntityType.FindProperty("NullableEnumU16Array")!; + var nullableEnumU16AsString = runtimeEntityType.FindProperty("NullableEnumU16AsString")!; + var nullableEnumU16AsStringArray = runtimeEntityType.FindProperty("NullableEnumU16AsStringArray")!; + var nullableEnumU16AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU16AsStringCollection")!; + var nullableEnumU16Collection = runtimeEntityType.FindProperty("NullableEnumU16Collection")!; + var nullableEnumU32 = runtimeEntityType.FindProperty("NullableEnumU32")!; + var nullableEnumU32Array = runtimeEntityType.FindProperty("NullableEnumU32Array")!; + var nullableEnumU32AsString = runtimeEntityType.FindProperty("NullableEnumU32AsString")!; + var nullableEnumU32AsStringArray = runtimeEntityType.FindProperty("NullableEnumU32AsStringArray")!; + var nullableEnumU32AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU32AsStringCollection")!; + var nullableEnumU32Collection = runtimeEntityType.FindProperty("NullableEnumU32Collection")!; + var nullableEnumU64 = runtimeEntityType.FindProperty("NullableEnumU64")!; + var nullableEnumU64Array = runtimeEntityType.FindProperty("NullableEnumU64Array")!; + var nullableEnumU64AsString = runtimeEntityType.FindProperty("NullableEnumU64AsString")!; + var nullableEnumU64AsStringArray = runtimeEntityType.FindProperty("NullableEnumU64AsStringArray")!; + var nullableEnumU64AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU64AsStringCollection")!; + var nullableEnumU64Collection = runtimeEntityType.FindProperty("NullableEnumU64Collection")!; + var nullableEnumU8 = runtimeEntityType.FindProperty("NullableEnumU8")!; + var nullableEnumU8Array = runtimeEntityType.FindProperty("NullableEnumU8Array")!; + var nullableEnumU8AsString = runtimeEntityType.FindProperty("NullableEnumU8AsString")!; + var nullableEnumU8AsStringArray = runtimeEntityType.FindProperty("NullableEnumU8AsStringArray")!; + var nullableEnumU8AsStringCollection = runtimeEntityType.FindProperty("NullableEnumU8AsStringCollection")!; + var nullableEnumU8Collection = runtimeEntityType.FindProperty("NullableEnumU8Collection")!; + var nullableFloat = runtimeEntityType.FindProperty("NullableFloat")!; + var nullableFloatArray = runtimeEntityType.FindProperty("NullableFloatArray")!; + var nullableGuid = runtimeEntityType.FindProperty("NullableGuid")!; + var nullableGuidArray = runtimeEntityType.FindProperty("NullableGuidArray")!; + var nullableIPAddress = runtimeEntityType.FindProperty("NullableIPAddress")!; + var nullableIPAddressArray = runtimeEntityType.FindProperty("NullableIPAddressArray")!; + var nullableInt16 = runtimeEntityType.FindProperty("NullableInt16")!; + var nullableInt16Array = runtimeEntityType.FindProperty("NullableInt16Array")!; + var nullableInt32 = runtimeEntityType.FindProperty("NullableInt32")!; + var nullableInt32Array = runtimeEntityType.FindProperty("NullableInt32Array")!; + var nullableInt64 = runtimeEntityType.FindProperty("NullableInt64")!; + var nullableInt64Array = runtimeEntityType.FindProperty("NullableInt64Array")!; + var nullableInt8 = runtimeEntityType.FindProperty("NullableInt8")!; + var nullableInt8Array = runtimeEntityType.FindProperty("NullableInt8Array")!; + var nullablePhysicalAddress = runtimeEntityType.FindProperty("NullablePhysicalAddress")!; + var nullablePhysicalAddressArray = runtimeEntityType.FindProperty("NullablePhysicalAddressArray")!; + var nullableString = runtimeEntityType.FindProperty("NullableString")!; + var nullableStringArray = runtimeEntityType.FindProperty("NullableStringArray")!; + var nullableTimeOnly = runtimeEntityType.FindProperty("NullableTimeOnly")!; + var nullableTimeOnlyArray = runtimeEntityType.FindProperty("NullableTimeOnlyArray")!; + var nullableTimeSpan = runtimeEntityType.FindProperty("NullableTimeSpan")!; + var nullableTimeSpanArray = runtimeEntityType.FindProperty("NullableTimeSpanArray")!; + var nullableUInt16 = runtimeEntityType.FindProperty("NullableUInt16")!; + var nullableUInt16Array = runtimeEntityType.FindProperty("NullableUInt16Array")!; + var nullableUInt32 = runtimeEntityType.FindProperty("NullableUInt32")!; + var nullableUInt32Array = runtimeEntityType.FindProperty("NullableUInt32Array")!; + var nullableUInt64 = runtimeEntityType.FindProperty("NullableUInt64")!; + var nullableUInt64Array = runtimeEntityType.FindProperty("NullableUInt64Array")!; + var nullableUInt8 = runtimeEntityType.FindProperty("NullableUInt8")!; + var nullableUInt8Array = runtimeEntityType.FindProperty("NullableUInt8Array")!; + var nullableUri = runtimeEntityType.FindProperty("NullableUri")!; + var nullableUriArray = runtimeEntityType.FindProperty("NullableUriArray")!; + var physicalAddress = runtimeEntityType.FindProperty("PhysicalAddress")!; + var physicalAddressArray = runtimeEntityType.FindProperty("PhysicalAddressArray")!; + var physicalAddressToBytesConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToBytesConverterProperty")!; + var physicalAddressToStringConverterProperty = runtimeEntityType.FindProperty("PhysicalAddressToStringConverterProperty")!; + var @string = runtimeEntityType.FindProperty("String")!; + var stringArray = runtimeEntityType.FindProperty("StringArray")!; + var stringToBoolConverterProperty = runtimeEntityType.FindProperty("StringToBoolConverterProperty")!; + var stringToBytesConverterProperty = runtimeEntityType.FindProperty("StringToBytesConverterProperty")!; + var stringToCharConverterProperty = runtimeEntityType.FindProperty("StringToCharConverterProperty")!; + var stringToDateOnlyConverterProperty = runtimeEntityType.FindProperty("StringToDateOnlyConverterProperty")!; + var stringToDateTimeConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeConverterProperty")!; + var stringToDateTimeOffsetConverterProperty = runtimeEntityType.FindProperty("StringToDateTimeOffsetConverterProperty")!; + var stringToDecimalNumberConverterProperty = runtimeEntityType.FindProperty("StringToDecimalNumberConverterProperty")!; + var stringToDoubleNumberConverterProperty = runtimeEntityType.FindProperty("StringToDoubleNumberConverterProperty")!; + var stringToEnumConverterProperty = runtimeEntityType.FindProperty("StringToEnumConverterProperty")!; + var stringToGuidConverterProperty = runtimeEntityType.FindProperty("StringToGuidConverterProperty")!; + var stringToIntNumberConverterProperty = runtimeEntityType.FindProperty("StringToIntNumberConverterProperty")!; + var stringToTimeOnlyConverterProperty = runtimeEntityType.FindProperty("StringToTimeOnlyConverterProperty")!; + var stringToTimeSpanConverterProperty = runtimeEntityType.FindProperty("StringToTimeSpanConverterProperty")!; + var stringToUriConverterProperty = runtimeEntityType.FindProperty("StringToUriConverterProperty")!; + var timeOnly = runtimeEntityType.FindProperty("TimeOnly")!; + var timeOnlyArray = runtimeEntityType.FindProperty("TimeOnlyArray")!; + var timeOnlyToStringConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToStringConverterProperty")!; + var timeOnlyToTicksConverterProperty = runtimeEntityType.FindProperty("TimeOnlyToTicksConverterProperty")!; + var timeSpan = runtimeEntityType.FindProperty("TimeSpan")!; + var timeSpanArray = runtimeEntityType.FindProperty("TimeSpanArray")!; + var timeSpanToStringConverterProperty = runtimeEntityType.FindProperty("TimeSpanToStringConverterProperty")!; + var timeSpanToTicksConverterProperty = runtimeEntityType.FindProperty("TimeSpanToTicksConverterProperty")!; + var uInt16 = runtimeEntityType.FindProperty("UInt16")!; + var uInt16Array = runtimeEntityType.FindProperty("UInt16Array")!; + var uInt32 = runtimeEntityType.FindProperty("UInt32")!; + var uInt32Array = runtimeEntityType.FindProperty("UInt32Array")!; + var uInt64 = runtimeEntityType.FindProperty("UInt64")!; + var uInt64Array = runtimeEntityType.FindProperty("UInt64Array")!; + var uInt8 = runtimeEntityType.FindProperty("UInt8")!; + var uInt8Array = runtimeEntityType.FindProperty("UInt8Array")!; + var uri = runtimeEntityType.FindProperty("Uri")!; + var uriArray = runtimeEntityType.FindProperty("UriArray")!; + var uriToStringConverterProperty = runtimeEntityType.FindProperty("UriToStringConverterProperty")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg = (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), ((ValueComparer)@bool.GetValueComparer()).Snapshot(source.GetCurrentValue(@bool)), (IEnumerable)source.GetCurrentValue(boolArray) == null ? null : (bool[])((ValueComparer>)boolArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(boolArray)), ((ValueComparer)boolToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToStringConverterProperty)), ((ValueComparer)boolToTwoValuesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToTwoValuesConverterProperty)), ((ValueComparer)boolToZeroOneConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(boolToZeroOneConverterProperty)), source.GetCurrentValue(bytes) == null ? null : ((ValueComparer)bytes.GetValueComparer()).Snapshot(source.GetCurrentValue(bytes)), (IEnumerable)source.GetCurrentValue(bytesArray) == null ? null : (byte[][])((ValueComparer>)bytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(bytesArray)), source.GetCurrentValue(bytesToStringConverterProperty) == null ? null : ((ValueComparer)bytesToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(bytesToStringConverterProperty)), ((ValueComparer)castingConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(castingConverterProperty)), ((ValueComparer)@char.GetValueComparer()).Snapshot(source.GetCurrentValue(@char)), (IEnumerable)source.GetCurrentValue(charArray) == null ? null : (char[])((ValueComparer>)charArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(charArray)), ((ValueComparer)charToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(charToStringConverterProperty)), ((ValueComparer)dateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnly)), (IEnumerable)source.GetCurrentValue(dateOnlyArray) == null ? null : (DateOnly[])((ValueComparer>)dateOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateOnlyArray)), ((ValueComparer)dateOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateOnlyToStringConverterProperty)), ((ValueComparer)dateTime.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTime)), (IEnumerable)source.GetCurrentValue(dateTimeArray) == null ? null : (DateTime[])((ValueComparer>)dateTimeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(dateTimeArray)), ((ValueComparer)dateTimeOffsetToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBinaryConverterProperty)), ((ValueComparer)dateTimeOffsetToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToBytesConverterProperty)), ((ValueComparer)dateTimeOffsetToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeOffsetToStringConverterProperty)), ((ValueComparer)dateTimeToBinaryConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToBinaryConverterProperty)), ((ValueComparer)dateTimeToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToStringConverterProperty)), ((ValueComparer)dateTimeToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(dateTimeToTicksConverterProperty)), ((ValueComparer)@decimal.GetValueComparer()).Snapshot(source.GetCurrentValue(@decimal)), (IEnumerable)source.GetCurrentValue(decimalArray) == null ? null : (decimal[])((ValueComparer>)decimalArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(decimalArray)), ((ValueComparer)decimalNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToBytesConverterProperty)), ((ValueComparer)decimalNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(decimalNumberToStringConverterProperty)), ((ValueComparer)@double.GetValueComparer()).Snapshot(source.GetCurrentValue(@double)), (IEnumerable)source.GetCurrentValue(doubleArray) == null ? null : (double[])((ValueComparer>)doubleArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(doubleArray))); + var entity0 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg0 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32[], List, List, CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], CompiledModelTestBase.Enum64, CompiledModelTestBase.Enum64[], List, List, CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], CompiledModelTestBase.Enum8, CompiledModelTestBase.Enum8[], List, List, CompiledModelTestBase.Enum32, CompiledModelTestBase.Enum32, CompiledModelTestBase.EnumU16, CompiledModelTestBase.EnumU16[]>(((ValueComparer)doubleNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToBytesConverterProperty)), ((ValueComparer)doubleNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(doubleNumberToStringConverterProperty)), ((ValueComparer)enum16.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16)), (IEnumerable)source.GetCurrentValue(enum16Array) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16Array)), ((ValueComparer)enum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum16AsString)), (IEnumerable)source.GetCurrentValue(enum16AsStringArray) == null ? null : (CompiledModelTestBase.Enum16[])((ValueComparer>)enum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum16AsStringCollection) == null ? null : (List)((ValueComparer>)enum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum16Collection) == null ? null : (List)((ValueComparer>)enum16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum16Collection)), ((ValueComparer)enum32.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32)), (IEnumerable)source.GetCurrentValue(enum32Array) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32Array)), ((ValueComparer)enum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum32AsString)), (IEnumerable)source.GetCurrentValue(enum32AsStringArray) == null ? null : (CompiledModelTestBase.Enum32[])((ValueComparer>)enum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum32AsStringCollection) == null ? null : (List)((ValueComparer>)enum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum32Collection) == null ? null : (List)((ValueComparer>)enum32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum32Collection)), ((ValueComparer)enum64.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64)), (IEnumerable)source.GetCurrentValue(enum64Array) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64Array)), ((ValueComparer)enum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum64AsString)), (IEnumerable)source.GetCurrentValue(enum64AsStringArray) == null ? null : (CompiledModelTestBase.Enum64[])((ValueComparer>)enum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum64AsStringCollection) == null ? null : (List)((ValueComparer>)enum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum64Collection) == null ? null : (List)((ValueComparer>)enum64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum64Collection)), ((ValueComparer)enum8.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8)), (IEnumerable)source.GetCurrentValue(enum8Array) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8Array)), ((ValueComparer)enum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enum8AsString)), (IEnumerable)source.GetCurrentValue(enum8AsStringArray) == null ? null : (CompiledModelTestBase.Enum8[])((ValueComparer>)enum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enum8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enum8AsStringCollection) == null ? null : (List)((ValueComparer>)enum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enum8Collection) == null ? null : (List)((ValueComparer>)enum8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enum8Collection)), ((ValueComparer)enumToNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToNumberConverterProperty)), ((ValueComparer)enumToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(enumToStringConverterProperty)), ((ValueComparer)enumU16.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16)), (IEnumerable)source.GetCurrentValue(enumU16Array) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16Array))); + var entity1 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg1 = (ISnapshot)new Snapshot, List, CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], CompiledModelTestBase.EnumU32, CompiledModelTestBase.EnumU32[], List, List, CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], CompiledModelTestBase.EnumU64, CompiledModelTestBase.EnumU64[], List, List, CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], CompiledModelTestBase.EnumU8, CompiledModelTestBase.EnumU8[], List, List, float, float[], Guid, Guid[], Guid, Guid, IPAddress, IPAddress[]>(((ValueComparer)enumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU16AsString)), (IEnumerable)source.GetCurrentValue(enumU16AsStringArray) == null ? null : (CompiledModelTestBase.EnumU16[])((ValueComparer>)enumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU16AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection) == null ? null : (List)((ValueComparer>)enumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU16Collection) == null ? null : (List)((ValueComparer>)enumU16Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU16Collection)), ((ValueComparer)enumU32.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32)), (IEnumerable)source.GetCurrentValue(enumU32Array) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32Array)), ((ValueComparer)enumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU32AsString)), (IEnumerable)source.GetCurrentValue(enumU32AsStringArray) == null ? null : (CompiledModelTestBase.EnumU32[])((ValueComparer>)enumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU32AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection) == null ? null : (List)((ValueComparer>)enumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU32Collection) == null ? null : (List)((ValueComparer>)enumU32Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU32Collection)), ((ValueComparer)enumU64.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64)), (IEnumerable)source.GetCurrentValue(enumU64Array) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64Array)), ((ValueComparer)enumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU64AsString)), (IEnumerable)source.GetCurrentValue(enumU64AsStringArray) == null ? null : (CompiledModelTestBase.EnumU64[])((ValueComparer>)enumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU64AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection) == null ? null : (List)((ValueComparer>)enumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU64Collection) == null ? null : (List)((ValueComparer>)enumU64Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU64Collection)), ((ValueComparer)enumU8.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8)), (IEnumerable)source.GetCurrentValue(enumU8Array) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8Array)), ((ValueComparer)enumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue(enumU8AsString)), (IEnumerable)source.GetCurrentValue(enumU8AsStringArray) == null ? null : (CompiledModelTestBase.EnumU8[])((ValueComparer>)enumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(enumU8AsStringArray)), (IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection) == null ? null : (List)((ValueComparer>)enumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8AsStringCollection)), (IEnumerable)source.GetCurrentValue>(enumU8Collection) == null ? null : (List)((ValueComparer>)enumU8Collection.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(enumU8Collection)), ((ValueComparer)@float.GetValueComparer()).Snapshot(source.GetCurrentValue(@float)), (IEnumerable)source.GetCurrentValue(floatArray) == null ? null : (float[])((ValueComparer>)floatArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(floatArray)), ((ValueComparer)guid.GetValueComparer()).Snapshot(source.GetCurrentValue(guid)), (IEnumerable)source.GetCurrentValue(guidArray) == null ? null : (Guid[])((ValueComparer>)guidArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(guidArray)), ((ValueComparer)guidToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToBytesConverterProperty)), ((ValueComparer)guidToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(guidToStringConverterProperty)), source.GetCurrentValue(iPAddress) == null ? null : ((ValueComparer)iPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddress)), (IEnumerable)source.GetCurrentValue(iPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)iPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(iPAddressArray))); + var entity2 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg2 = (ISnapshot)new Snapshot, Nullable, Nullable[], byte[], byte[][], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable>(source.GetCurrentValue(iPAddressToBytesConverterProperty) == null ? null : ((ValueComparer)iPAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToBytesConverterProperty)), source.GetCurrentValue(iPAddressToStringConverterProperty) == null ? null : ((ValueComparer)iPAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(iPAddressToStringConverterProperty)), ((ValueComparer)int16.GetValueComparer()).Snapshot(source.GetCurrentValue(int16)), (IEnumerable)source.GetCurrentValue(int16Array) == null ? null : (short[])((ValueComparer>)int16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int16Array)), ((ValueComparer)int32.GetValueComparer()).Snapshot(source.GetCurrentValue(int32)), (IEnumerable)source.GetCurrentValue(int32Array) == null ? null : (int[])((ValueComparer>)int32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int32Array)), ((ValueComparer)int64.GetValueComparer()).Snapshot(source.GetCurrentValue(int64)), (IEnumerable)source.GetCurrentValue(int64Array) == null ? null : (long[])((ValueComparer>)int64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int64Array)), ((ValueComparer)int8.GetValueComparer()).Snapshot(source.GetCurrentValue(int8)), (IEnumerable)source.GetCurrentValue(int8Array) == null ? null : (sbyte[])((ValueComparer>)int8Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(int8Array)), ((ValueComparer)intNumberToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToBytesConverterProperty)), ((ValueComparer)intNumberToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(intNumberToStringConverterProperty)), source.GetCurrentValue>(nullIntToNullStringConverterProperty) == null ? null : ((ValueComparer>)nullIntToNullStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullIntToNullStringConverterProperty)), source.GetCurrentValue>(nullableBool) == null ? null : ((ValueComparer>)nullableBool.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableBool)), (IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray) == null ? null : (Nullable[])((ValueComparer>>)nullableBoolArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableBoolArray)), source.GetCurrentValue(nullableBytes) == null ? null : ((ValueComparer)nullableBytes.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableBytes)), (IEnumerable)source.GetCurrentValue(nullableBytesArray) == null ? null : (byte[][])((ValueComparer>)nullableBytesArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableBytesArray)), source.GetCurrentValue>(nullableChar) == null ? null : ((ValueComparer>)nullableChar.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableChar)), (IEnumerable>)source.GetCurrentValue[]>(nullableCharArray) == null ? null : (Nullable[])((ValueComparer>>)nullableCharArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableCharArray)), source.GetCurrentValue>(nullableDateOnly) == null ? null : ((ValueComparer>)nullableDateOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateOnlyArray)), source.GetCurrentValue>(nullableDateTime) == null ? null : ((ValueComparer>)nullableDateTime.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDateTime)), (IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDateTimeArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDateTimeArray)), source.GetCurrentValue>(nullableDecimal) == null ? null : ((ValueComparer>)nullableDecimal.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDecimal)), (IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDecimalArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDecimalArray)), source.GetCurrentValue>(nullableDouble) == null ? null : ((ValueComparer>)nullableDouble.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableDouble)), (IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray) == null ? null : (Nullable[])((ValueComparer>>)nullableDoubleArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableDoubleArray)), source.GetCurrentValue>(nullableEnum16) == null ? null : ((ValueComparer>)nullableEnum16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16Array)), source.GetCurrentValue>(nullableEnum16AsString) == null ? null : ((ValueComparer>)nullableEnum16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum16AsString))); + var entity3 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg3 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable>((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum16Collection)), source.GetCurrentValue>(nullableEnum32) == null ? null : ((ValueComparer>)nullableEnum32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32Array)), source.GetCurrentValue>(nullableEnum32AsString) == null ? null : ((ValueComparer>)nullableEnum32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum32AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum32Collection)), source.GetCurrentValue>(nullableEnum64) == null ? null : ((ValueComparer>)nullableEnum64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64Array)), source.GetCurrentValue>(nullableEnum64AsString) == null ? null : ((ValueComparer>)nullableEnum64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum64Collection)), source.GetCurrentValue>(nullableEnum8) == null ? null : ((ValueComparer>)nullableEnum8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8Array)), source.GetCurrentValue>(nullableEnum8AsString) == null ? null : ((ValueComparer>)nullableEnum8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnum8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnum8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnum8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnum8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnum8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnum8Collection)), source.GetCurrentValue>(nullableEnumU16) == null ? null : ((ValueComparer>)nullableEnumU16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16Array)), source.GetCurrentValue>(nullableEnumU16AsString) == null ? null : ((ValueComparer>)nullableEnumU16AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU16AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU16AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU16AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU16Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU16Collection)), source.GetCurrentValue>(nullableEnumU32) == null ? null : ((ValueComparer>)nullableEnumU32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32Array)), source.GetCurrentValue>(nullableEnumU32AsString) == null ? null : ((ValueComparer>)nullableEnumU32AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU32AsString))); + var entity4 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg4 = (ISnapshot)new Snapshot[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], List>, List>, Nullable, Nullable[], Nullable, Nullable[], IPAddress, IPAddress[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], PhysicalAddress>((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU32AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU32AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU32Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU32Collection)), source.GetCurrentValue>(nullableEnumU64) == null ? null : ((ValueComparer>)nullableEnumU64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64Array)), source.GetCurrentValue>(nullableEnumU64AsString) == null ? null : ((ValueComparer>)nullableEnumU64AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU64AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU64AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU64AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU64Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU64Collection)), source.GetCurrentValue>(nullableEnumU8) == null ? null : ((ValueComparer>)nullableEnumU8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8Array)), source.GetCurrentValue>(nullableEnumU8AsString) == null ? null : ((ValueComparer>)nullableEnumU8AsString.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableEnumU8AsString)), (IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray) == null ? null : (Nullable[])((ValueComparer>>)nullableEnumU8AsStringArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableEnumU8AsStringArray)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8AsStringCollection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8AsStringCollection)), (IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection) == null ? null : (List>)((ValueComparer>>)nullableEnumU8Collection.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue>>(nullableEnumU8Collection)), source.GetCurrentValue>(nullableFloat) == null ? null : ((ValueComparer>)nullableFloat.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableFloat)), (IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray) == null ? null : (Nullable[])((ValueComparer>>)nullableFloatArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableFloatArray)), source.GetCurrentValue>(nullableGuid) == null ? null : ((ValueComparer>)nullableGuid.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableGuid)), (IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray) == null ? null : (Nullable[])((ValueComparer>>)nullableGuidArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableGuidArray)), source.GetCurrentValue(nullableIPAddress) == null ? null : ((ValueComparer)nullableIPAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableIPAddress)), (IEnumerable)source.GetCurrentValue(nullableIPAddressArray) == null ? null : (IPAddress[])((ValueComparer>)nullableIPAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableIPAddressArray)), source.GetCurrentValue>(nullableInt16) == null ? null : ((ValueComparer>)nullableInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt16Array)), source.GetCurrentValue>(nullableInt32) == null ? null : ((ValueComparer>)nullableInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt32Array)), source.GetCurrentValue>(nullableInt64) == null ? null : ((ValueComparer>)nullableInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt64Array)), source.GetCurrentValue>(nullableInt8) == null ? null : ((ValueComparer>)nullableInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableInt8Array)), source.GetCurrentValue(nullablePhysicalAddress) == null ? null : ((ValueComparer)nullablePhysicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(nullablePhysicalAddress))); + var entity5 = (CompiledModelTestBase.ManyTypes)source.Entity; + var liftedArg5 = (ISnapshot)new Snapshot, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Nullable, Nullable[], Uri, Uri[], PhysicalAddress, PhysicalAddress[], PhysicalAddress, PhysicalAddress, string, string[], string, string, string, string, string, string, string>((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)nullablePhysicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullablePhysicalAddressArray)), source.GetCurrentValue(nullableString) == null ? null : ((ValueComparer)nullableString.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableString)), (IEnumerable)source.GetCurrentValue(nullableStringArray) == null ? null : (string[])((ValueComparer>)nullableStringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableStringArray)), source.GetCurrentValue>(nullableTimeOnly) == null ? null : ((ValueComparer>)nullableTimeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeOnly)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeOnlyArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeOnlyArray)), source.GetCurrentValue>(nullableTimeSpan) == null ? null : ((ValueComparer>)nullableTimeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableTimeSpan)), (IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray) == null ? null : (Nullable[])((ValueComparer>>)nullableTimeSpanArray.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableTimeSpanArray)), source.GetCurrentValue>(nullableUInt16) == null ? null : ((ValueComparer>)nullableUInt16.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt16)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt16Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt16Array)), source.GetCurrentValue>(nullableUInt32) == null ? null : ((ValueComparer>)nullableUInt32.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt32)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt32Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt32Array)), source.GetCurrentValue>(nullableUInt64) == null ? null : ((ValueComparer>)nullableUInt64.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt64)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt64Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt64Array)), source.GetCurrentValue>(nullableUInt8) == null ? null : ((ValueComparer>)nullableUInt8.GetValueComparer()).Snapshot(source.GetCurrentValue>(nullableUInt8)), (IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array) == null ? null : (Nullable[])((ValueComparer>>)nullableUInt8Array.GetValueComparer()).Snapshot((IEnumerable>)source.GetCurrentValue[]>(nullableUInt8Array)), source.GetCurrentValue(nullableUri) == null ? null : ((ValueComparer)nullableUri.GetValueComparer()).Snapshot(source.GetCurrentValue(nullableUri)), (IEnumerable)source.GetCurrentValue(nullableUriArray) == null ? null : (Uri[])((ValueComparer>)nullableUriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(nullableUriArray)), source.GetCurrentValue(physicalAddress) == null ? null : ((ValueComparer)physicalAddress.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddress)), (IEnumerable)source.GetCurrentValue(physicalAddressArray) == null ? null : (PhysicalAddress[])((ValueComparer>)physicalAddressArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(physicalAddressArray)), source.GetCurrentValue(physicalAddressToBytesConverterProperty) == null ? null : ((ValueComparer)physicalAddressToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToBytesConverterProperty)), source.GetCurrentValue(physicalAddressToStringConverterProperty) == null ? null : ((ValueComparer)physicalAddressToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(physicalAddressToStringConverterProperty)), source.GetCurrentValue(@string) == null ? null : ((ValueComparer)@string.GetValueComparer()).Snapshot(source.GetCurrentValue(@string)), (IEnumerable)source.GetCurrentValue(stringArray) == null ? null : (string[])((ValueComparer>)stringArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(stringArray)), source.GetCurrentValue(stringToBoolConverterProperty) == null ? null : ((ValueComparer)stringToBoolConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBoolConverterProperty)), source.GetCurrentValue(stringToBytesConverterProperty) == null ? null : ((ValueComparer)stringToBytesConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToBytesConverterProperty)), source.GetCurrentValue(stringToCharConverterProperty) == null ? null : ((ValueComparer)stringToCharConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToCharConverterProperty)), source.GetCurrentValue(stringToDateOnlyConverterProperty) == null ? null : ((ValueComparer)stringToDateOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateOnlyConverterProperty)), source.GetCurrentValue(stringToDateTimeConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeConverterProperty)), source.GetCurrentValue(stringToDateTimeOffsetConverterProperty) == null ? null : ((ValueComparer)stringToDateTimeOffsetConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDateTimeOffsetConverterProperty)), source.GetCurrentValue(stringToDecimalNumberConverterProperty) == null ? null : ((ValueComparer)stringToDecimalNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDecimalNumberConverterProperty))); + var entity6 = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new MultiSnapshot(new ISnapshot[] { liftedArg, liftedArg0, liftedArg1, liftedArg2, liftedArg3, liftedArg4, liftedArg5, (ISnapshot)new Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty) == null ? null : ((ValueComparer)stringToDoubleNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToDoubleNumberConverterProperty)), source.GetCurrentValue(stringToEnumConverterProperty) == null ? null : ((ValueComparer)stringToEnumConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToEnumConverterProperty)), source.GetCurrentValue(stringToGuidConverterProperty) == null ? null : ((ValueComparer)stringToGuidConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToGuidConverterProperty)), source.GetCurrentValue(stringToIntNumberConverterProperty) == null ? null : ((ValueComparer)stringToIntNumberConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToIntNumberConverterProperty)), source.GetCurrentValue(stringToTimeOnlyConverterProperty) == null ? null : ((ValueComparer)stringToTimeOnlyConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeOnlyConverterProperty)), source.GetCurrentValue(stringToTimeSpanConverterProperty) == null ? null : ((ValueComparer)stringToTimeSpanConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToTimeSpanConverterProperty)), source.GetCurrentValue(stringToUriConverterProperty) == null ? null : ((ValueComparer)stringToUriConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(stringToUriConverterProperty)), ((ValueComparer)timeOnly.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnly)), (IEnumerable)source.GetCurrentValue(timeOnlyArray) == null ? null : (TimeOnly[])((ValueComparer>)timeOnlyArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeOnlyArray)), ((ValueComparer)timeOnlyToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToStringConverterProperty)), ((ValueComparer)timeOnlyToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeOnlyToTicksConverterProperty)), ((ValueComparer)timeSpan.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpan)), (IEnumerable)source.GetCurrentValue(timeSpanArray) == null ? null : (TimeSpan[])((ValueComparer>)timeSpanArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(timeSpanArray)), ((ValueComparer)timeSpanToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToStringConverterProperty)), ((ValueComparer)timeSpanToTicksConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(timeSpanToTicksConverterProperty)), ((ValueComparer)uInt16.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt16)), (IEnumerable)source.GetCurrentValue(uInt16Array) == null ? null : (ushort[])((ValueComparer>)uInt16Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt16Array)), ((ValueComparer)uInt32.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt32)), (IEnumerable)source.GetCurrentValue(uInt32Array) == null ? null : (uint[])((ValueComparer>)uInt32Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt32Array)), ((ValueComparer)uInt64.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt64)), (IEnumerable)source.GetCurrentValue(uInt64Array) == null ? null : (ulong[])((ValueComparer>)uInt64Array.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uInt64Array)), ((ValueComparer)uInt8.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8)), source.GetCurrentValue(uInt8Array) == null ? null : ((ValueComparer)uInt8Array.GetValueComparer()).Snapshot(source.GetCurrentValue(uInt8Array)), source.GetCurrentValue(uri) == null ? null : ((ValueComparer)uri.GetValueComparer()).Snapshot(source.GetCurrentValue(uri)), (IEnumerable)source.GetCurrentValue(uriArray) == null ? null : (Uri[])((ValueComparer>)uriArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(uriArray)), source.GetCurrentValue(uriToStringConverterProperty) == null ? null : ((ValueComparer)uriToStringConverterProperty.GetValueComparer()).Snapshot(source.GetCurrentValue(uriToStringConverterProperty))) }); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(CompiledModelTestBase.ManyTypesId)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(CompiledModelTestBase.ManyTypesId))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.ManyTypes)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 236, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 236, + shadowCount: 0, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -8299,5 +13537,2129 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.ManyTypesId GetId(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.ManyTypesId ReadId(CompiledModelTestBase.ManyTypes @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.ManyTypesId value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBool(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBool(CompiledModelTestBase.ManyTypes @this) + => GetBool(@this); + + public static void WriteBool(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool[] GetBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool[] ReadBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetBoolArray(@this); + + public static void WriteBoolArray(CompiledModelTestBase.ManyTypes @this, bool[] value) + => GetBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToStringConverterProperty(@this); + + public static void WriteBoolToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToTwoValuesConverterProperty(@this); + + public static void WriteBoolToTwoValuesConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToTwoValuesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool GetBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static bool ReadBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBoolToZeroOneConverterProperty(@this); + + public static void WriteBoolToZeroOneConverterProperty(CompiledModelTestBase.ManyTypes @this, bool value) + => GetBoolToZeroOneConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytes(CompiledModelTestBase.ManyTypes @this) + => GetBytes(@this); + + public static void WriteBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetBytesArray(@this); + + public static void WriteBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetBytesToStringConverterProperty(@this); + + public static void WriteBytesToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetBytesToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetCastingConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadCastingConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCastingConverterProperty(@this); + + public static void WriteCastingConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetCastingConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetChar(CompiledModelTestBase.ManyTypes @this); + + public static char ReadChar(CompiledModelTestBase.ManyTypes @this) + => GetChar(@this); + + public static void WriteChar(CompiledModelTestBase.ManyTypes @this, char value) + => GetChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char[] GetCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char[] ReadCharArray(CompiledModelTestBase.ManyTypes @this) + => GetCharArray(@this); + + public static void WriteCharArray(CompiledModelTestBase.ManyTypes @this, char[] value) + => GetCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char GetCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static char ReadCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetCharToStringConverterProperty(@this); + + public static void WriteCharToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, char value) + => GetCharToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetDateOnly(@this); + + public static void WriteDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly[] GetDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly[] ReadDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyArray(@this); + + public static void WriteDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly[] value) + => GetDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly GetDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly ReadDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateOnlyToStringConverterProperty(@this); + + public static void WriteDateOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateOnly value) + => GetDateOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTime(CompiledModelTestBase.ManyTypes @this) + => GetDateTime(@this); + + public static void WriteDateTime(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime[] ReadDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeArray(@this); + + public static void WriteDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime[] value) + => GetDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBinaryConverterProperty(@this); + + public static void WriteDateTimeOffsetToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToBytesConverterProperty(@this); + + public static void WriteDateTimeOffsetToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTimeOffset GetDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTimeOffset ReadDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeOffsetToStringConverterProperty(@this); + + public static void WriteDateTimeOffsetToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTimeOffset value) + => GetDateTimeOffsetToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToBinaryConverterProperty(@this); + + public static void WriteDateTimeToBinaryConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToBinaryConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToStringConverterProperty(@this); + + public static void WriteDateTimeToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime GetDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static DateTime ReadDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDateTimeToTicksConverterProperty(@this); + + public static void WriteDateTimeToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, DateTime value) + => GetDateTimeToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimal(CompiledModelTestBase.ManyTypes @this) + => GetDecimal(@this); + + public static void WriteDecimal(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal[] GetDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal[] ReadDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetDecimalArray(@this); + + public static void WriteDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal[] value) + => GetDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToBytesConverterProperty(@this); + + public static void WriteDecimalNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal GetDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static decimal ReadDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDecimalNumberToStringConverterProperty(@this); + + public static void WriteDecimalNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, decimal value) + => GetDecimalNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDouble(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDouble(CompiledModelTestBase.ManyTypes @this) + => GetDouble(@this); + + public static void WriteDouble(CompiledModelTestBase.ManyTypes @this, double value) + => GetDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double[] GetDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double[] ReadDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetDoubleArray(@this); + + public static void WriteDoubleArray(CompiledModelTestBase.ManyTypes @this, double[] value) + => GetDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToBytesConverterProperty(@this); + + public static void WriteDoubleNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double GetDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static double ReadDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetDoubleNumberToStringConverterProperty(@this); + + public static void WriteDoubleNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, double value) + => GetDoubleNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16(CompiledModelTestBase.ManyTypes @this) + => GetEnum16(@this); + + public static void WriteEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Array(@this); + + public static void WriteEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16 GetEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16 ReadEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsString(@this); + + public static void WriteEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16 value) + => GetEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16[] GetEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16[] ReadEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringArray(@this); + + public static void WriteEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16[] value) + => GetEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16AsStringCollection(@this); + + public static void WriteEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum16Collection(@this); + + public static void WriteEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32(CompiledModelTestBase.ManyTypes @this) + => GetEnum32(@this); + + public static void WriteEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Array(@this); + + public static void WriteEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsString(@this); + + public static void WriteEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32[] GetEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32[] ReadEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringArray(@this); + + public static void WriteEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32[] value) + => GetEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32AsStringCollection(@this); + + public static void WriteEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum32Collection(@this); + + public static void WriteEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64(CompiledModelTestBase.ManyTypes @this) + => GetEnum64(@this); + + public static void WriteEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Array(@this); + + public static void WriteEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64 GetEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64 ReadEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsString(@this); + + public static void WriteEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64 value) + => GetEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64[] GetEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64[] ReadEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringArray(@this); + + public static void WriteEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64[] value) + => GetEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64AsStringCollection(@this); + + public static void WriteEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum64Collection(@this); + + public static void WriteEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8(CompiledModelTestBase.ManyTypes @this) + => GetEnum8(@this); + + public static void WriteEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Array(@this); + + public static void WriteEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8 GetEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8 ReadEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsString(@this); + + public static void WriteEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8 value) + => GetEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8[] GetEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8[] ReadEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringArray(@this); + + public static void WriteEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8[] value) + => GetEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8AsStringCollection(@this); + + public static void WriteEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnum8Collection(@this); + + public static void WriteEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToNumberConverterProperty(@this); + + public static void WriteEnumToNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32 GetEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32 ReadEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetEnumToStringConverterProperty(@this); + + public static void WriteEnumToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32 value) + => GetEnumToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16(@this); + + public static void WriteEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Array(@this); + + public static void WriteEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16 GetEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16 ReadEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsString(@this); + + public static void WriteEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16 value) + => GetEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16[] GetEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16[] ReadEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringArray(@this); + + public static void WriteEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16[] value) + => GetEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16AsStringCollection(@this); + + public static void WriteEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU16Collection(@this); + + public static void WriteEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32(@this); + + public static void WriteEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Array(@this); + + public static void WriteEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32 GetEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32 ReadEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsString(@this); + + public static void WriteEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32 value) + => GetEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32[] GetEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32[] ReadEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringArray(@this); + + public static void WriteEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32[] value) + => GetEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32AsStringCollection(@this); + + public static void WriteEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU32Collection(@this); + + public static void WriteEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64(@this); + + public static void WriteEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Array(@this); + + public static void WriteEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64 GetEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64 ReadEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsString(@this); + + public static void WriteEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64 value) + => GetEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64[] GetEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64[] ReadEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringArray(@this); + + public static void WriteEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64[] value) + => GetEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64AsStringCollection(@this); + + public static void WriteEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU64Collection(@this); + + public static void WriteEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8(@this); + + public static void WriteEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Array(@this); + + public static void WriteEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8 GetEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8 ReadEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsString(@this); + + public static void WriteEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8 value) + => GetEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8[] GetEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8[] ReadEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringArray(@this); + + public static void WriteEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8[] value) + => GetEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8AsStringCollection(@this); + + public static void WriteEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetEnumU8Collection(@this); + + public static void WriteEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float GetFloat(CompiledModelTestBase.ManyTypes @this); + + public static float ReadFloat(CompiledModelTestBase.ManyTypes @this) + => GetFloat(@this); + + public static void WriteFloat(CompiledModelTestBase.ManyTypes @this, float value) + => GetFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float[] GetFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float[] ReadFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetFloatArray(@this); + + public static void WriteFloatArray(CompiledModelTestBase.ManyTypes @this, float[] value) + => GetFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuid(CompiledModelTestBase.ManyTypes @this) + => GetGuid(@this); + + public static void WriteGuid(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid[] GetGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid[] ReadGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetGuidArray(@this); + + public static void WriteGuidArray(CompiledModelTestBase.ManyTypes @this, Guid[] value) + => GetGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToBytesConverterProperty(@this); + + public static void WriteGuidToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid GetGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Guid ReadGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetGuidToStringConverterProperty(@this); + + public static void WriteGuidToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Guid value) + => GetGuidToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetIPAddress(@this); + + public static void WriteIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressArray(@this); + + public static void WriteIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToBytesConverterProperty(@this); + + public static void WriteIPAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIPAddressToStringConverterProperty(@this); + + public static void WriteIPAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetIPAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short GetInt16(CompiledModelTestBase.ManyTypes @this); + + public static short ReadInt16(CompiledModelTestBase.ManyTypes @this) + => GetInt16(@this); + + public static void WriteInt16(CompiledModelTestBase.ManyTypes @this, short value) + => GetInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short[] GetInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short[] ReadInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetInt16Array(@this); + + public static void WriteInt16Array(CompiledModelTestBase.ManyTypes @this, short[] value) + => GetInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetInt32(CompiledModelTestBase.ManyTypes @this); + + public static int ReadInt32(CompiledModelTestBase.ManyTypes @this) + => GetInt32(@this); + + public static void WriteInt32(CompiledModelTestBase.ManyTypes @this, int value) + => GetInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int[] GetInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int[] ReadInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetInt32Array(@this); + + public static void WriteInt32Array(CompiledModelTestBase.ManyTypes @this, int[] value) + => GetInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long GetInt64(CompiledModelTestBase.ManyTypes @this); + + public static long ReadInt64(CompiledModelTestBase.ManyTypes @this) + => GetInt64(@this); + + public static void WriteInt64(CompiledModelTestBase.ManyTypes @this, long value) + => GetInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long[] GetInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long[] ReadInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetInt64Array(@this); + + public static void WriteInt64Array(CompiledModelTestBase.ManyTypes @this, long[] value) + => GetInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte GetInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte ReadInt8(CompiledModelTestBase.ManyTypes @this) + => GetInt8(@this); + + public static void WriteInt8(CompiledModelTestBase.ManyTypes @this, sbyte value) + => GetInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte[] GetInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte[] ReadInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetInt8Array(@this); + + public static void WriteInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte[] value) + => GetInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToBytesConverterProperty(@this); + + public static void WriteIntNumberToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int ReadIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetIntNumberToStringConverterProperty(@this); + + public static void WriteIntNumberToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int value) + => GetIntNumberToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetNullIntToNullStringConverterProperty(@this); + + public static void WriteNullIntToNullStringConverterProperty(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullIntToNullStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool? GetNullableBool(CompiledModelTestBase.ManyTypes @this); + + public static bool? ReadNullableBool(CompiledModelTestBase.ManyTypes @this) + => GetNullableBool(@this); + + public static void WriteNullableBool(CompiledModelTestBase.ManyTypes @this, bool? value) + => GetNullableBool(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref bool?[] GetNullableBoolArray(CompiledModelTestBase.ManyTypes @this); + + public static bool?[] ReadNullableBoolArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBoolArray(@this); + + public static void WriteNullableBoolArray(CompiledModelTestBase.ManyTypes @this, bool?[] value) + => GetNullableBoolArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetNullableBytes(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadNullableBytes(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytes(@this); + + public static void WriteNullableBytes(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetNullableBytes(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[][] GetNullableBytesArray(CompiledModelTestBase.ManyTypes @this); + + public static byte[][] ReadNullableBytesArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableBytesArray(@this); + + public static void WriteNullableBytesArray(CompiledModelTestBase.ManyTypes @this, byte[][] value) + => GetNullableBytesArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char? GetNullableChar(CompiledModelTestBase.ManyTypes @this); + + public static char? ReadNullableChar(CompiledModelTestBase.ManyTypes @this) + => GetNullableChar(@this); + + public static void WriteNullableChar(CompiledModelTestBase.ManyTypes @this, char? value) + => GetNullableChar(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref char?[] GetNullableCharArray(CompiledModelTestBase.ManyTypes @this); + + public static char?[] ReadNullableCharArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableCharArray(@this); + + public static void WriteNullableCharArray(CompiledModelTestBase.ManyTypes @this, char?[] value) + => GetNullableCharArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly? GetNullableDateOnly(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly? ReadNullableDateOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnly(@this); + + public static void WriteNullableDateOnly(CompiledModelTestBase.ManyTypes @this, DateOnly? value) + => GetNullableDateOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateOnly?[] GetNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static DateOnly?[] ReadNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateOnlyArray(@this); + + public static void WriteNullableDateOnlyArray(CompiledModelTestBase.ManyTypes @this, DateOnly?[] value) + => GetNullableDateOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime? GetNullableDateTime(CompiledModelTestBase.ManyTypes @this); + + public static DateTime? ReadNullableDateTime(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTime(@this); + + public static void WriteNullableDateTime(CompiledModelTestBase.ManyTypes @this, DateTime? value) + => GetNullableDateTime(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime?[] GetNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this); + + public static DateTime?[] ReadNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDateTimeArray(@this); + + public static void WriteNullableDateTimeArray(CompiledModelTestBase.ManyTypes @this, DateTime?[] value) + => GetNullableDateTimeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal? GetNullableDecimal(CompiledModelTestBase.ManyTypes @this); + + public static decimal? ReadNullableDecimal(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimal(@this); + + public static void WriteNullableDecimal(CompiledModelTestBase.ManyTypes @this, decimal? value) + => GetNullableDecimal(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref decimal?[] GetNullableDecimalArray(CompiledModelTestBase.ManyTypes @this); + + public static decimal?[] ReadNullableDecimalArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDecimalArray(@this); + + public static void WriteNullableDecimalArray(CompiledModelTestBase.ManyTypes @this, decimal?[] value) + => GetNullableDecimalArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double? GetNullableDouble(CompiledModelTestBase.ManyTypes @this); + + public static double? ReadNullableDouble(CompiledModelTestBase.ManyTypes @this) + => GetNullableDouble(@this); + + public static void WriteNullableDouble(CompiledModelTestBase.ManyTypes @this, double? value) + => GetNullableDouble(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref double?[] GetNullableDoubleArray(CompiledModelTestBase.ManyTypes @this); + + public static double?[] ReadNullableDoubleArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableDoubleArray(@this); + + public static void WriteNullableDoubleArray(CompiledModelTestBase.ManyTypes @this, double?[] value) + => GetNullableDoubleArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16(@this); + + public static void WriteNullableEnum16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Array(@this); + + public static void WriteNullableEnum16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16? GetNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16? ReadNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsString(@this); + + public static void WriteNullableEnum16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16? value) + => GetNullableEnum16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum16?[] GetNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum16?[] ReadNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringArray(@this); + + public static void WriteNullableEnum16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum16?[] value) + => GetNullableEnum16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16AsStringCollection(@this); + + public static void WriteNullableEnum16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum16Collection(@this); + + public static void WriteNullableEnum16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32(@this); + + public static void WriteNullableEnum32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Array(@this); + + public static void WriteNullableEnum32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32? GetNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32? ReadNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsString(@this); + + public static void WriteNullableEnum32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32? value) + => GetNullableEnum32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum32?[] GetNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum32?[] ReadNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringArray(@this); + + public static void WriteNullableEnum32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum32?[] value) + => GetNullableEnum32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32AsStringCollection(@this); + + public static void WriteNullableEnum32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum32Collection(@this); + + public static void WriteNullableEnum32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64(@this); + + public static void WriteNullableEnum64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Array(@this); + + public static void WriteNullableEnum64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64? GetNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64? ReadNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsString(@this); + + public static void WriteNullableEnum64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64? value) + => GetNullableEnum64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum64?[] GetNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum64?[] ReadNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringArray(@this); + + public static void WriteNullableEnum64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum64?[] value) + => GetNullableEnum64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64AsStringCollection(@this); + + public static void WriteNullableEnum64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum64Collection(@this); + + public static void WriteNullableEnum64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8(@this); + + public static void WriteNullableEnum8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Array(@this); + + public static void WriteNullableEnum8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8? GetNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8? ReadNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsString(@this); + + public static void WriteNullableEnum8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8? value) + => GetNullableEnum8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.Enum8?[] GetNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.Enum8?[] ReadNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringArray(@this); + + public static void WriteNullableEnum8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.Enum8?[] value) + => GetNullableEnum8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8AsStringCollection(@this); + + public static void WriteNullableEnum8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnum8Collection(@this); + + public static void WriteNullableEnum8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnum8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16(@this); + + public static void WriteNullableEnumU16(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Array(@this); + + public static void WriteNullableEnumU16Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16? GetNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16? ReadNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsString(@this); + + public static void WriteNullableEnumU16AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16? value) + => GetNullableEnumU16AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU16?[] GetNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU16?[] ReadNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringArray(@this); + + public static void WriteNullableEnumU16AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU16?[] value) + => GetNullableEnumU16AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16AsStringCollection(@this); + + public static void WriteNullableEnumU16AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU16Collection(@this); + + public static void WriteNullableEnumU16Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU16Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32(@this); + + public static void WriteNullableEnumU32(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Array(@this); + + public static void WriteNullableEnumU32Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32? GetNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32? ReadNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsString(@this); + + public static void WriteNullableEnumU32AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32? value) + => GetNullableEnumU32AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU32?[] GetNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU32?[] ReadNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringArray(@this); + + public static void WriteNullableEnumU32AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU32?[] value) + => GetNullableEnumU32AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32AsStringCollection(@this); + + public static void WriteNullableEnumU32AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU32Collection(@this); + + public static void WriteNullableEnumU32Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU32Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64(@this); + + public static void WriteNullableEnumU64(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Array(@this); + + public static void WriteNullableEnumU64Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64? GetNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64? ReadNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsString(@this); + + public static void WriteNullableEnumU64AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64? value) + => GetNullableEnumU64AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU64?[] GetNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU64?[] ReadNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringArray(@this); + + public static void WriteNullableEnumU64AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU64?[] value) + => GetNullableEnumU64AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64AsStringCollection(@this); + + public static void WriteNullableEnumU64AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU64Collection(@this); + + public static void WriteNullableEnumU64Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU64Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8(@this); + + public static void WriteNullableEnumU8(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Array(@this); + + public static void WriteNullableEnumU8Array(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8? GetNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8? ReadNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsString(@this); + + public static void WriteNullableEnumU8AsString(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8? value) + => GetNullableEnumU8AsString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.EnumU8?[] GetNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this); + + public static CompiledModelTestBase.EnumU8?[] ReadNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringArray(@this); + + public static void WriteNullableEnumU8AsStringArray(CompiledModelTestBase.ManyTypes @this, CompiledModelTestBase.EnumU8?[] value) + => GetNullableEnumU8AsStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8AsStringCollection(@this); + + public static void WriteNullableEnumU8AsStringCollection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8AsStringCollection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this); + + public static List ReadNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this) + => GetNullableEnumU8Collection(@this); + + public static void WriteNullableEnumU8Collection(CompiledModelTestBase.ManyTypes @this, List value) + => GetNullableEnumU8Collection(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float? GetNullableFloat(CompiledModelTestBase.ManyTypes @this); + + public static float? ReadNullableFloat(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloat(@this); + + public static void WriteNullableFloat(CompiledModelTestBase.ManyTypes @this, float? value) + => GetNullableFloat(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref float?[] GetNullableFloatArray(CompiledModelTestBase.ManyTypes @this); + + public static float?[] ReadNullableFloatArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableFloatArray(@this); + + public static void WriteNullableFloatArray(CompiledModelTestBase.ManyTypes @this, float?[] value) + => GetNullableFloatArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid? GetNullableGuid(CompiledModelTestBase.ManyTypes @this); + + public static Guid? ReadNullableGuid(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuid(@this); + + public static void WriteNullableGuid(CompiledModelTestBase.ManyTypes @this, Guid? value) + => GetNullableGuid(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Guid?[] GetNullableGuidArray(CompiledModelTestBase.ManyTypes @this); + + public static Guid?[] ReadNullableGuidArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableGuidArray(@this); + + public static void WriteNullableGuidArray(CompiledModelTestBase.ManyTypes @this, Guid?[] value) + => GetNullableGuidArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress GetNullableIPAddress(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress ReadNullableIPAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddress(@this); + + public static void WriteNullableIPAddress(CompiledModelTestBase.ManyTypes @this, IPAddress value) + => GetNullableIPAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static IPAddress[] ReadNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableIPAddressArray(@this); + + public static void WriteNullableIPAddressArray(CompiledModelTestBase.ManyTypes @this, IPAddress[] value) + => GetNullableIPAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short? GetNullableInt16(CompiledModelTestBase.ManyTypes @this); + + public static short? ReadNullableInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16(@this); + + public static void WriteNullableInt16(CompiledModelTestBase.ManyTypes @this, short? value) + => GetNullableInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref short?[] GetNullableInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static short?[] ReadNullableInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt16Array(@this); + + public static void WriteNullableInt16Array(CompiledModelTestBase.ManyTypes @this, short?[] value) + => GetNullableInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int? GetNullableInt32(CompiledModelTestBase.ManyTypes @this); + + public static int? ReadNullableInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32(@this); + + public static void WriteNullableInt32(CompiledModelTestBase.ManyTypes @this, int? value) + => GetNullableInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int?[] GetNullableInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static int?[] ReadNullableInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt32Array(@this); + + public static void WriteNullableInt32Array(CompiledModelTestBase.ManyTypes @this, int?[] value) + => GetNullableInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetNullableInt64(CompiledModelTestBase.ManyTypes @this); + + public static long? ReadNullableInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64(@this); + + public static void WriteNullableInt64(CompiledModelTestBase.ManyTypes @this, long? value) + => GetNullableInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long?[] GetNullableInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static long?[] ReadNullableInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt64Array(@this); + + public static void WriteNullableInt64Array(CompiledModelTestBase.ManyTypes @this, long?[] value) + => GetNullableInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte? GetNullableInt8(CompiledModelTestBase.ManyTypes @this); + + public static sbyte? ReadNullableInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8(@this); + + public static void WriteNullableInt8(CompiledModelTestBase.ManyTypes @this, sbyte? value) + => GetNullableInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref sbyte?[] GetNullableInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static sbyte?[] ReadNullableInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableInt8Array(@this); + + public static void WriteNullableInt8Array(CompiledModelTestBase.ManyTypes @this, sbyte?[] value) + => GetNullableInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddress(@this); + + public static void WriteNullablePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetNullablePhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetNullablePhysicalAddressArray(@this); + + public static void WriteNullablePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetNullablePhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetNullableString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadNullableString(CompiledModelTestBase.ManyTypes @this) + => GetNullableString(@this); + + public static void WriteNullableString(CompiledModelTestBase.ManyTypes @this, string value) + => GetNullableString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetNullableStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadNullableStringArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableStringArray(@this); + + public static void WriteNullableStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetNullableStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly? GetNullableTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly? ReadNullableTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnly(@this); + + public static void WriteNullableTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly? value) + => GetNullableTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly?[] GetNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly?[] ReadNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeOnlyArray(@this); + + public static void WriteNullableTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly?[] value) + => GetNullableTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan? GetNullableTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan? ReadNullableTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpan(@this); + + public static void WriteNullableTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan? value) + => GetNullableTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan?[] GetNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan?[] ReadNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableTimeSpanArray(@this); + + public static void WriteNullableTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan?[] value) + => GetNullableTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort? GetNullableUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort? ReadNullableUInt16(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16(@this); + + public static void WriteNullableUInt16(CompiledModelTestBase.ManyTypes @this, ushort? value) + => GetNullableUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort?[] GetNullableUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort?[] ReadNullableUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt16Array(@this); + + public static void WriteNullableUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort?[] value) + => GetNullableUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint? GetNullableUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint? ReadNullableUInt32(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32(@this); + + public static void WriteNullableUInt32(CompiledModelTestBase.ManyTypes @this, uint? value) + => GetNullableUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint?[] GetNullableUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint?[] ReadNullableUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt32Array(@this); + + public static void WriteNullableUInt32Array(CompiledModelTestBase.ManyTypes @this, uint?[] value) + => GetNullableUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong? GetNullableUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong? ReadNullableUInt64(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64(@this); + + public static void WriteNullableUInt64(CompiledModelTestBase.ManyTypes @this, ulong? value) + => GetNullableUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong?[] GetNullableUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong?[] ReadNullableUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt64Array(@this); + + public static void WriteNullableUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong?[] value) + => GetNullableUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte? GetNullableUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte? ReadNullableUInt8(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8(@this); + + public static void WriteNullableUInt8(CompiledModelTestBase.ManyTypes @this, byte? value) + => GetNullableUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte?[] GetNullableUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte?[] ReadNullableUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetNullableUInt8Array(@this); + + public static void WriteNullableUInt8Array(CompiledModelTestBase.ManyTypes @this, byte?[] value) + => GetNullableUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetNullableUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadNullableUri(CompiledModelTestBase.ManyTypes @this) + => GetNullableUri(@this); + + public static void WriteNullableUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetNullableUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetNullableUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadNullableUriArray(CompiledModelTestBase.ManyTypes @this) + => GetNullableUriArray(@this); + + public static void WriteNullableUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetNullableUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddress(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddress(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddress(@this); + + public static void WritePhysicalAddress(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddress(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress[] GetPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress[] ReadPhysicalAddressArray(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressArray(@this); + + public static void WritePhysicalAddressArray(CompiledModelTestBase.ManyTypes @this, PhysicalAddress[] value) + => GetPhysicalAddressArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToBytesConverterProperty(@this); + + public static void WritePhysicalAddressToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref PhysicalAddress GetPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static PhysicalAddress ReadPhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetPhysicalAddressToStringConverterProperty(@this); + + public static void WritePhysicalAddressToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, PhysicalAddress value) + => GetPhysicalAddressToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetString(CompiledModelTestBase.ManyTypes @this); + + public static string ReadString(CompiledModelTestBase.ManyTypes @this) + => GetString(@this); + + public static void WriteString(CompiledModelTestBase.ManyTypes @this, string value) + => GetString(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string[] GetStringArray(CompiledModelTestBase.ManyTypes @this); + + public static string[] ReadStringArray(CompiledModelTestBase.ManyTypes @this) + => GetStringArray(@this); + + public static void WriteStringArray(CompiledModelTestBase.ManyTypes @this, string[] value) + => GetStringArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBoolConverterProperty(@this); + + public static void WriteStringToBoolConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBoolConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToBytesConverterProperty(@this); + + public static void WriteStringToBytesConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToBytesConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToCharConverterProperty(@this); + + public static void WriteStringToCharConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToCharConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateOnlyConverterProperty(@this); + + public static void WriteStringToDateOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeConverterProperty(@this); + + public static void WriteStringToDateTimeConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDateTimeOffsetConverterProperty(@this); + + public static void WriteStringToDateTimeOffsetConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDateTimeOffsetConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDecimalNumberConverterProperty(@this); + + public static void WriteStringToDecimalNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDecimalNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToDoubleNumberConverterProperty(@this); + + public static void WriteStringToDoubleNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToDoubleNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToEnumConverterProperty(@this); + + public static void WriteStringToEnumConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToEnumConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToGuidConverterProperty(@this); + + public static void WriteStringToGuidConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToGuidConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToIntNumberConverterProperty(@this); + + public static void WriteStringToIntNumberConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToIntNumberConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeOnlyConverterProperty(@this); + + public static void WriteStringToTimeOnlyConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeOnlyConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToTimeSpanConverterProperty(@this); + + public static void WriteStringToTimeSpanConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToTimeSpanConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref string GetStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static string ReadStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetStringToUriConverterProperty(@this); + + public static void WriteStringToUriConverterProperty(CompiledModelTestBase.ManyTypes @this, string value) + => GetStringToUriConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnly(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnly(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnly(@this); + + public static void WriteTimeOnly(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnly(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly[] GetTimeOnlyArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly[] ReadTimeOnlyArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyArray(@this); + + public static void WriteTimeOnlyArray(CompiledModelTestBase.ManyTypes @this, TimeOnly[] value) + => GetTimeOnlyArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToStringConverterProperty(@this); + + public static void WriteTimeOnlyToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeOnly GetTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeOnly ReadTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeOnlyToTicksConverterProperty(@this); + + public static void WriteTimeOnlyToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeOnly value) + => GetTimeOnlyToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpan(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpan(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpan(@this); + + public static void WriteTimeSpan(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpan(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan[] GetTimeSpanArray(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan[] ReadTimeSpanArray(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanArray(@this); + + public static void WriteTimeSpanArray(CompiledModelTestBase.ManyTypes @this, TimeSpan[] value) + => GetTimeSpanArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToStringConverterProperty(@this); + + public static void WriteTimeSpanToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToStringConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref TimeSpan GetTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static TimeSpan ReadTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetTimeSpanToTicksConverterProperty(@this); + + public static void WriteTimeSpanToTicksConverterProperty(CompiledModelTestBase.ManyTypes @this, TimeSpan value) + => GetTimeSpanToTicksConverterProperty(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort GetUInt16(CompiledModelTestBase.ManyTypes @this); + + public static ushort ReadUInt16(CompiledModelTestBase.ManyTypes @this) + => GetUInt16(@this); + + public static void WriteUInt16(CompiledModelTestBase.ManyTypes @this, ushort value) + => GetUInt16(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ushort[] GetUInt16Array(CompiledModelTestBase.ManyTypes @this); + + public static ushort[] ReadUInt16Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt16Array(@this); + + public static void WriteUInt16Array(CompiledModelTestBase.ManyTypes @this, ushort[] value) + => GetUInt16Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint GetUInt32(CompiledModelTestBase.ManyTypes @this); + + public static uint ReadUInt32(CompiledModelTestBase.ManyTypes @this) + => GetUInt32(@this); + + public static void WriteUInt32(CompiledModelTestBase.ManyTypes @this, uint value) + => GetUInt32(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref uint[] GetUInt32Array(CompiledModelTestBase.ManyTypes @this); + + public static uint[] ReadUInt32Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt32Array(@this); + + public static void WriteUInt32Array(CompiledModelTestBase.ManyTypes @this, uint[] value) + => GetUInt32Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong GetUInt64(CompiledModelTestBase.ManyTypes @this); + + public static ulong ReadUInt64(CompiledModelTestBase.ManyTypes @this) + => GetUInt64(@this); + + public static void WriteUInt64(CompiledModelTestBase.ManyTypes @this, ulong value) + => GetUInt64(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ulong[] GetUInt64Array(CompiledModelTestBase.ManyTypes @this); + + public static ulong[] ReadUInt64Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt64Array(@this); + + public static void WriteUInt64Array(CompiledModelTestBase.ManyTypes @this, ulong[] value) + => GetUInt64Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte GetUInt8(CompiledModelTestBase.ManyTypes @this); + + public static byte ReadUInt8(CompiledModelTestBase.ManyTypes @this) + => GetUInt8(@this); + + public static void WriteUInt8(CompiledModelTestBase.ManyTypes @this, byte value) + => GetUInt8(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetUInt8Array(CompiledModelTestBase.ManyTypes @this); + + public static byte[] ReadUInt8Array(CompiledModelTestBase.ManyTypes @this) + => GetUInt8Array(@this); + + public static void WriteUInt8Array(CompiledModelTestBase.ManyTypes @this, byte[] value) + => GetUInt8Array(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUri(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUri(CompiledModelTestBase.ManyTypes @this) + => GetUri(@this); + + public static void WriteUri(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUri(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri[] GetUriArray(CompiledModelTestBase.ManyTypes @this); + + public static Uri[] ReadUriArray(CompiledModelTestBase.ManyTypes @this) + => GetUriArray(@this); + + public static void WriteUriArray(CompiledModelTestBase.ManyTypes @this, Uri[] value) + => GetUriArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref Uri GetUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this); + + public static Uri ReadUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this) + => GetUriToStringConverterProperty(@this); + + public static void WriteUriToStringConverterProperty(CompiledModelTestBase.ManyTypes @this, Uri value) + => GetUriToStringConverterProperty(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs index d5a66173928..a907cb3a6d0 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedType0EntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -37,6 +40,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalDerivedId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalDerivedId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -52,13 +61,21 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalDerivedId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedId)); var principalDerivedAlternateId = runtimeEntityType.AddProperty( "PrincipalDerivedAlternateId", typeof(Guid), afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalDerivedAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalDerivedAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalDerivedAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalDerivedAlternateId)); var id = runtimeEntityType.AddProperty( "Id", @@ -66,6 +83,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 2, + relationshipIndex: 2, + storeGenerationIndex: 2); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -81,6 +104,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var details = runtimeEntityType.AddProperty( "Details", @@ -88,6 +112,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Details", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[3]); + details.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqliteStringTypeMapping.Default; var number = runtimeEntityType.AddProperty( @@ -96,6 +141,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("Number", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[4]); + number.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -118,6 +184,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeArray.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -173,6 +260,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeEnumerable.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -198,6 +306,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeIList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -223,6 +352,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeList.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -278,6 +428,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeArray.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -303,6 +474,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeEnumerable.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -342,6 +534,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeIList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -381,6 +594,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.OwnedType).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeList.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -442,11 +676,79 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("ManyOwned", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), eagerLoaded: true); + manyOwned.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => PrincipalDerivedEntityType.ReadManyOwned(instance) == null); + manyOwned.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => PrincipalDerivedEntityType.WriteManyOwned(entity, value)); + manyOwned.SetAccessors( + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => PrincipalDerivedEntityType.ReadManyOwned((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(manyOwned), + null); + manyOwned.SetPropertyIndexes( + index: 3, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 5, + storeGenerationIndex: -1); + manyOwned.SetCollectionAccessor>, ICollection, CompiledModelTestBase.OwnedType>( + (CompiledModelTestBase.PrincipalDerived>> entity) => PrincipalDerivedEntityType.ReadManyOwned(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => PrincipalDerivedEntityType.WriteManyOwned(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.OwnedType>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalDerivedId = runtimeEntityType.FindProperty("PrincipalDerivedId")!; + var principalDerivedAlternateId = runtimeEntityType.FindProperty("PrincipalDerivedAlternateId")!; + var id = runtimeEntityType.FindProperty("Id")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalDerivedAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalDerivedId") ? (long)source["PrincipalDerivedId"] : 0L, source.ContainsKey("PrincipalDerivedAlternateId") ? (Guid)source["PrincipalDerivedAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"), source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid), default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalDerivedId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedId)), ((ValueComparer)principalDerivedAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalDerivedAlternateId)), ((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 13, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 13, + shadowCount: 3, + relationshipCount: 3, + storeGeneratedCount: 3); runtimeEntityType.AddAnnotation("Relational:ContainerColumnName", "ManyOwned"); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -459,5 +761,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs index e5cf465b977..331cb7fe5aa 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/OwnedTypeEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -39,6 +42,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0L); + principalBaseId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); principalBaseId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -54,6 +63,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalBaseId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseId)); var principalBaseAlternateId = runtimeEntityType.AddProperty( "PrincipalBaseAlternateId", @@ -61,7 +71,14 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyAccessMode: PropertyAccessMode.Field, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + principalBaseAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: 1, + relationshipIndex: 1, + storeGenerationIndex: 1); principalBaseAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalBaseAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalBaseAlternateId)); var details = runtimeEntityType.AddProperty( "Details", @@ -70,6 +87,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_details", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + details.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity), + (CompiledModelTestBase.OwnedType entity) => ReadDetails(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance), + (CompiledModelTestBase.OwnedType instance) => ReadDetails(instance) == null); + details.SetSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, string value) => WriteDetails(entity, value)); + details.SetAccessors( + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadDetails((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(details, 2), + (InternalEntityEntry entry) => entry.GetCurrentValue(details), + (ValueBuffer valueBuffer) => valueBuffer[2]); + details.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); details.TypeMapping = SqliteStringTypeMapping.Default; var number = runtimeEntityType.AddProperty( @@ -79,6 +117,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, sentinel: 0); + number.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity), + (CompiledModelTestBase.OwnedType entity) => ReadNumber(entity) == 0, + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance), + (CompiledModelTestBase.OwnedType instance) => ReadNumber(instance) == 0); + number.SetSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, int value) => WriteNumber(entity, value)); + number.SetAccessors( + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadNumber((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(number, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(number), + (ValueBuffer valueBuffer) => valueBuffer[3]); + number.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); number.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -102,6 +161,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[4]); + refTypeArray.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -158,6 +238,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[5]); + refTypeEnumerable.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -184,6 +285,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeIList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[6]); + refTypeIList.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -210,6 +332,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_refTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 7), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[7]); + refTypeList.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -266,6 +409,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeArray", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[8]); + valueTypeArray.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -292,6 +456,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeEnumerable", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[9]); + valueTypeEnumerable.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -332,6 +517,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + valueTypeIList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -372,6 +578,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas fieldInfo: typeof(CompiledModelTestBase.OwnedType).GetField("_valueTypeList", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), propertyAccessMode: PropertyAccessMode.Field, nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.OwnedType entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.OwnedType instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.OwnedType entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.OwnedType)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + valueTypeList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -437,11 +664,72 @@ public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEnt propertyAccessMode: PropertyAccessMode.Field, eagerLoaded: true); + owned.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity), + (CompiledModelTestBase.PrincipalBase entity) => PrincipalBaseEntityType.ReadOwned(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance), + (CompiledModelTestBase.PrincipalBase instance) => PrincipalBaseEntityType.ReadOwned(instance) == null); + owned.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.OwnedType value) => PrincipalBaseEntityType.WriteOwned(entity, value)); + owned.SetAccessors( + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => PrincipalBaseEntityType.ReadOwned((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue(owned), + null); + owned.SetPropertyIndexes( + index: 0, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: -1); return runtimeForeignKey; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var principalBaseId = runtimeEntityType.FindProperty("PrincipalBaseId")!; + var principalBaseAlternateId = runtimeEntityType.FindProperty("PrincipalBaseAlternateId")!; + var details = runtimeEntityType.FindProperty("Details")!; + var number = runtimeEntityType.FindProperty("Number")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot, IList, List, DateTime[], IEnumerable, IList, List>(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId)), source.GetCurrentValue(details) == null ? null : ((ValueComparer)details.GetValueComparer()).Snapshot(source.GetCurrentValue(details)), ((ValueComparer)number.GetValueComparer()).Snapshot(source.GetCurrentValue(number)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalBaseAlternateId.GetValueComparer()).Snapshot(default(Guid)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("PrincipalBaseId") ? (long)source["PrincipalBaseId"] : 0L, source.ContainsKey("PrincipalBaseAlternateId") ? (Guid)source["PrincipalBaseAlternateId"] : new Guid("00000000-0000-0000-0000-000000000000"))); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(long), default(Guid))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.OwnedType)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)principalBaseId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseId)), ((ValueComparer)principalBaseAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalBaseAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 12, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 12, + shadowCount: 2, + relationshipCount: 2, + storeGeneratedCount: 2); runtimeEntityType.AddAnnotation("Relational:ContainerColumnName", "Owned"); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -454,5 +742,95 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_details")] + extern static ref string GetDetails(CompiledModelTestBase.OwnedType @this); + + public static string ReadDetails(CompiledModelTestBase.OwnedType @this) + => GetDetails(@this); + + public static void WriteDetails(CompiledModelTestBase.OwnedType @this, string value) + => GetDetails(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref int GetNumber(CompiledModelTestBase.OwnedType @this); + + public static int ReadNumber(CompiledModelTestBase.OwnedType @this) + => GetNumber(@this); + + public static void WriteNumber(CompiledModelTestBase.OwnedType @this, int value) + => GetNumber(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeArray")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.OwnedType @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.OwnedType @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.OwnedType @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeEnumerable")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeIList")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_refTypeList")] + extern static ref List GetRefTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadRefTypeList(CompiledModelTestBase.OwnedType @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeArray")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.OwnedType @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.OwnedType @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.OwnedType @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeEnumerable")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.OwnedType @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.OwnedType @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.OwnedType @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.OwnedType @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.OwnedType @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_valueTypeList")] + extern static ref List GetValueTypeList(CompiledModelTestBase.OwnedType @this); + + public static List ReadValueTypeList(CompiledModelTestBase.OwnedType @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.OwnedType @this, List value) + => GetValueTypeList(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs index d9638287999..47eb47fa1e3 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBaseEntityType.cs @@ -3,9 +3,12 @@ using System.Collections.Generic; using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Json.Internal; @@ -43,6 +46,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), afterSaveBehavior: PropertySaveBehavior.Throw); + id.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadId(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadId(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadId(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadId(instance).HasValue); + id.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteId(entity, value)); + id.SetAccessors( + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadId((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(id, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue>(id, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: -1); id.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && (long)v1 == (long)v2 || !v1.HasValue && !v2.HasValue, @@ -58,6 +82,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (Nullable v) => v.HasValue ? (Nullable)(long)v : default(Nullable)), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var alternateId = runtimeEntityType.AddProperty( "AlternateId", @@ -67,7 +92,29 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: new Guid("00000000-0000-0000-0000-000000000000"), jsonValueReaderWriter: new CompiledModelTestBase.MyJsonGuidReaderWriter()); + alternateId.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId, + (CompiledModelTestBase.PrincipalBase entity) => entity.AlternateId == new Guid("00000000-0000-0000-0000-000000000000"), + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId, + (CompiledModelTestBase.PrincipalBase instance) => instance.AlternateId == new Guid("00000000-0000-0000-0000-000000000000")); + alternateId.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Guid value) => entity.AlternateId = value); + alternateId.SetAccessors( + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => ((CompiledModelTestBase.PrincipalBase)entry.Entity).AlternateId, + (InternalEntityEntry entry) => entry.ReadOriginalValue(alternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(alternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + alternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: -1); alternateId.TypeMapping = SqliteGuidTypeMapping.Default; + alternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(alternateId)); var discriminator = runtimeEntityType.AddProperty( "Discriminator", @@ -75,6 +122,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas afterSaveBehavior: PropertySaveBehavior.Throw, maxLength: 55, valueGeneratorFactory: new DiscriminatorValueGeneratorFactory().Create); + discriminator.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: 0, + relationshipIndex: -1, + storeGenerationIndex: -1); discriminator.TypeMapping = SqliteStringTypeMapping.Default; var enum1 = runtimeEntityType.AddProperty( @@ -82,6 +135,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AnEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + enum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadEnum1(entity), (object)(CompiledModelTestBase.AnEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadEnum1(instance), (object)(CompiledModelTestBase.AnEnum)0L)); + enum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AnEnum value) => WriteEnum1(entity, value)); + enum1.SetAccessors( + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(enum1, 3), + (InternalEntityEntry entry) => entry.GetCurrentValue(enum1), + (ValueBuffer valueBuffer) => valueBuffer[3]); + enum1.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AnEnum v1, CompiledModelTestBase.AnEnum v2) => object.Equals((object)v1, (object)v2), @@ -113,6 +187,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("Enum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + enum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => !ReadEnum2(entity).HasValue, + (CompiledModelTestBase.PrincipalBase instance) => ReadEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => !ReadEnum2(instance).HasValue); + enum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, Nullable value) => WriteEnum2(entity, value == null ? value : (Nullable)(CompiledModelTestBase.AnEnum)value)); + enum2.SetAccessors( + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(enum2, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue>(enum2), + (ValueBuffer valueBuffer) => valueBuffer[4]); + enum2.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); enum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (Nullable v1, Nullable v2) => v1.HasValue && v2.HasValue && object.Equals((object)(CompiledModelTestBase.AnEnum)v1, (object)(CompiledModelTestBase.AnEnum)v2) || !v1.HasValue && !v2.HasValue, @@ -142,6 +237,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum1", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum1.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum1(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum1(entity), (object)(CompiledModelTestBase.AFlagsEnum)0L), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum1(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum1(instance), (object)(CompiledModelTestBase.AFlagsEnum)0L)); + flagsEnum1.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum1(entity, value)); + flagsEnum1.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum1((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum1, 5), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum1), + (ValueBuffer valueBuffer) => valueBuffer[5]); + flagsEnum1.SetPropertyIndexes( + index: 5, + originalValueIndex: 5, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum1.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -172,6 +288,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(CompiledModelTestBase.AFlagsEnum), propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("FlagsEnum2", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + flagsEnum2.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadFlagsEnum2(entity), + (CompiledModelTestBase.PrincipalBase entity) => object.Equals((object)ReadFlagsEnum2(entity), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C)), + (CompiledModelTestBase.PrincipalBase instance) => ReadFlagsEnum2(instance), + (CompiledModelTestBase.PrincipalBase instance) => object.Equals((object)ReadFlagsEnum2(instance), (object)(CompiledModelTestBase.AFlagsEnum.B | CompiledModelTestBase.AFlagsEnum.C))); + flagsEnum2.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, CompiledModelTestBase.AFlagsEnum value) => WriteFlagsEnum2(entity, value)); + flagsEnum2.SetAccessors( + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadFlagsEnum2((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(flagsEnum2, 6), + (InternalEntityEntry entry) => entry.GetCurrentValue(flagsEnum2), + (ValueBuffer valueBuffer) => valueBuffer[6]); + flagsEnum2.SetPropertyIndexes( + index: 6, + originalValueIndex: 6, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); flagsEnum2.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (CompiledModelTestBase.AFlagsEnum v1, CompiledModelTestBase.AFlagsEnum v2) => object.Equals((object)v1, (object)v2), @@ -205,6 +342,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueConverter: new CastingConverter(), valueComparer: new CompiledModelTestBase.CustomValueComparer(), providerValueComparer: new CompiledModelTestBase.CustomValueComparer()); + point.SetPropertyIndexes( + index: 7, + originalValueIndex: 7, + shadowIndex: 1, + relationshipIndex: -1, + storeGenerationIndex: 0); point.TypeMapping = null; point.AddAnnotation("Relational:ColumnType", "geometry"); point.AddAnnotation("Relational:DefaultValue", (NetTopologySuite.Geometries.Point)new NetTopologySuite.IO.WKTReader().Read("SRID=0;POINT Z(0 0 0)")); @@ -215,6 +358,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeArray(instance) == null); + refTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IPAddress[] value) => WriteRefTypeArray(entity, value)); + refTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(refTypeArray, 8), + (InternalEntityEntry entry) => entry.GetCurrentValue(refTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[8]); + refTypeArray.SetPropertyIndexes( + index: 8, + originalValueIndex: 8, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -270,6 +434,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeEnumerable(instance) == null); + refTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteRefTypeEnumerable(entity, value)); + refTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeEnumerable, 9), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[9]); + refTypeEnumerable.SetPropertyIndexes( + index: 9, + originalValueIndex: 9, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -295,6 +480,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeIList(instance) == null); + refTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteRefTypeIList(entity, value)); + refTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeIList, 10), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[10]); + refTypeIList.SetPropertyIndexes( + index: 10, + originalValueIndex: 10, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (string v1, string v2) => v1 == v2, @@ -320,6 +526,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("RefTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + refTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadRefTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadRefTypeList(instance) == null); + refTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteRefTypeList(entity, value)); + refTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadRefTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(refTypeList, 11), + (InternalEntityEntry entry) => entry.GetCurrentValue>(refTypeList), + (ValueBuffer valueBuffer) => valueBuffer[11]); + refTypeList.SetPropertyIndexes( + index: 11, + originalValueIndex: 11, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); refTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (IPAddress v1, IPAddress v2) => v1 == null && v2 == null || v1 != null && v2 != null && v1.Equals(v2), @@ -375,6 +602,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeArray", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeArray.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeArray(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeArray(instance) == null); + valueTypeArray.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, DateTime[] value) => WriteValueTypeArray(entity, value)); + valueTypeArray.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeArray((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(valueTypeArray, 12), + (InternalEntityEntry entry) => entry.GetCurrentValue(valueTypeArray), + (ValueBuffer valueBuffer) => valueBuffer[12]); + valueTypeArray.SetPropertyIndexes( + index: 12, + originalValueIndex: 12, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeArray.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (DateTime v1, DateTime v2) => v1.Equals(v2), @@ -400,6 +648,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeEnumerable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeEnumerable.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeEnumerable(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeEnumerable(instance) == null); + valueTypeEnumerable.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IEnumerable value) => WriteValueTypeEnumerable(entity, value)); + valueTypeEnumerable.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeEnumerable((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeEnumerable, 13), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeEnumerable), + (ValueBuffer valueBuffer) => valueBuffer[13]); + valueTypeEnumerable.SetPropertyIndexes( + index: 13, + originalValueIndex: 13, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeEnumerable.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -439,6 +708,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeIList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeIList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeIList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeIList(instance) == null); + valueTypeIList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, IList value) => WriteValueTypeIList(entity, value)); + valueTypeIList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeIList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeIList, 14), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeIList), + (ValueBuffer valueBuffer) => valueBuffer[14]); + valueTypeIList.SetPropertyIndexes( + index: 14, + originalValueIndex: 14, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeIList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (byte v1, byte v2) => v1 == v2, @@ -478,6 +768,27 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.PrincipalBase).GetProperty("ValueTypeList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.PrincipalBase).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + valueTypeList.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadValueTypeList(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadValueTypeList(instance) == null); + valueTypeList.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, List value) => WriteValueTypeList(entity, value)); + valueTypeList.SetAccessors( + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadValueTypeList((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue>(valueTypeList, 15), + (InternalEntityEntry entry) => entry.GetCurrentValue>(valueTypeList), + (ValueBuffer valueBuffer) => valueBuffer[15]); + valueTypeList.SetPropertyIndexes( + index: 15, + originalValueIndex: 15, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); valueTypeList.TypeMapping = SqliteStringTypeMapping.Default.Clone( comparer: new ListComparer(new ValueComparer( (short v1, short v2) => v1 == v2, @@ -547,11 +858,83 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity) == null, + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance), + (CompiledModelTestBase.PrincipalBase instance) => ReadDeriveds(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalBase entity, ICollection value) => WriteDeriveds(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + (InternalEntityEntry entry) => ReadDeriveds((CompiledModelTestBase.PrincipalBase)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 1, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalBase entity) => ReadDeriveds(entity), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, ICollection collection) => WriteDeriveds(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalBase entity, Action> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var point = runtimeEntityType.FindProperty("Point")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Point, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(default(Point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(default(Point)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(Point))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string), default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalBase)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), ReadOwned(entity), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 16, + navigationCount: 2, + complexPropertyCount: 0, + originalValueCount: 16, + shadowCount: 2, + relationshipCount: 4, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:MappingStrategy", "TPH"); runtimeEntityType.AddAnnotation("Relational:Schema", null); @@ -564,5 +947,140 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref long? GetId(CompiledModelTestBase.PrincipalBase @this); + + public static long? ReadId(CompiledModelTestBase.PrincipalBase @this) + => GetId(@this); + + public static void WriteId(CompiledModelTestBase.PrincipalBase @this, long? value) + => GetId(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum GetEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum ReadEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetEnum1(@this); + + public static void WriteEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum value) + => GetEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AnEnum? GetEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AnEnum? ReadEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetEnum2(@this); + + public static void WriteEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AnEnum? value) + => GetEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum1(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum1(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum1(@this); + + public static void WriteFlagsEnum1(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum1(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.AFlagsEnum GetFlagsEnum2(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.AFlagsEnum ReadFlagsEnum2(CompiledModelTestBase.PrincipalBase @this) + => GetFlagsEnum2(@this); + + public static void WriteFlagsEnum2(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.AFlagsEnum value) + => GetFlagsEnum2(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IPAddress[] GetRefTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static IPAddress[] ReadRefTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeArray(@this); + + public static void WriteRefTypeArray(CompiledModelTestBase.PrincipalBase @this, IPAddress[] value) + => GetRefTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeEnumerable(@this); + + public static void WriteRefTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetRefTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetRefTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadRefTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeIList(@this); + + public static void WriteRefTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetRefTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetRefTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadRefTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetRefTypeList(@this); + + public static void WriteRefTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetRefTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref DateTime[] GetValueTypeArray(CompiledModelTestBase.PrincipalBase @this); + + public static DateTime[] ReadValueTypeArray(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeArray(@this); + + public static void WriteValueTypeArray(CompiledModelTestBase.PrincipalBase @this, DateTime[] value) + => GetValueTypeArray(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IEnumerable GetValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this); + + public static IEnumerable ReadValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeEnumerable(@this); + + public static void WriteValueTypeEnumerable(CompiledModelTestBase.PrincipalBase @this, IEnumerable value) + => GetValueTypeEnumerable(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref IList GetValueTypeIList(CompiledModelTestBase.PrincipalBase @this); + + public static IList ReadValueTypeIList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeIList(@this); + + public static void WriteValueTypeIList(CompiledModelTestBase.PrincipalBase @this, IList value) + => GetValueTypeIList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref List GetValueTypeList(CompiledModelTestBase.PrincipalBase @this); + + public static List ReadValueTypeList(CompiledModelTestBase.PrincipalBase @this) + => GetValueTypeList(@this); + + public static void WriteValueTypeList(CompiledModelTestBase.PrincipalBase @this, List value) + => GetValueTypeList(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetDeriveds(CompiledModelTestBase.PrincipalBase @this); + + public static ICollection ReadDeriveds(CompiledModelTestBase.PrincipalBase @this) + => GetDeriveds(@this); + + public static void WriteDeriveds(CompiledModelTestBase.PrincipalBase @this, ICollection value) + => GetDeriveds(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_ownedField")] + extern static ref CompiledModelTestBase.OwnedType GetOwned(CompiledModelTestBase.PrincipalBase @this); + + public static CompiledModelTestBase.OwnedType ReadOwned(CompiledModelTestBase.PrincipalBase @this) + => GetOwned(@this); + + public static void WriteOwned(CompiledModelTestBase.PrincipalBase @this, CompiledModelTestBase.OwnedType value) + => GetOwned(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs index 43b8727c14d..f637dfc110d 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalBasePrincipalDerivedDependentBasebyteEntityType.cs @@ -6,7 +6,9 @@ using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -36,6 +38,51 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null ? 0L : (long)(entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsId") ? entity["DerivedsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null ? 0L : (long)(instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsId") ? instance["DerivedsId"] : null) == null); + derivedsId.SetSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["DerivedsId"] = (object)value); + derivedsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(0)) + { + return entry.ReadStoreGeneratedValue(0); + } + else + { + { + if (entry.FlaggedAsTemporary(0) && (((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null) == null) + { + return entry.ReadTemporaryValue(0); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsId") ? ((Dictionary)entry.Entity)["DerivedsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsId, 0), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsId, 0), + (ValueBuffer valueBuffer) => valueBuffer[0]); + derivedsId.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: 0, + storeGenerationIndex: 0); derivedsId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -51,19 +98,111 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + derivedsId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsId)); var derivedsAlternateId = runtimeEntityType.AddProperty( "DerivedsAlternateId", typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + derivedsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("DerivedsAlternateId") ? entity["DerivedsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("DerivedsAlternateId") ? instance["DerivedsAlternateId"] : null) == null); + derivedsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["DerivedsAlternateId"] = (object)value); + derivedsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(1)) + { + return entry.ReadStoreGeneratedValue(1); + } + else + { + { + if (entry.FlaggedAsTemporary(1) && (((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(1); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("DerivedsAlternateId") ? ((Dictionary)entry.Entity)["DerivedsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(derivedsAlternateId, 1), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(derivedsAlternateId, 1), + (ValueBuffer valueBuffer) => valueBuffer[1]); + derivedsAlternateId.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: 1, + storeGenerationIndex: 1); derivedsAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + derivedsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(derivedsAlternateId)); var principalsId = runtimeEntityType.AddProperty( "PrincipalsId", typeof(long), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null ? 0L : (long)(entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsId") ? entity["PrincipalsId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null ? 0L : (long)(instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsId") ? instance["PrincipalsId"] : null) == null); + principalsId.SetSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetMaterializationSetter( + (Dictionary entity, long value) => entity["PrincipalsId"] = (object)value); + principalsId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(2)) + { + return entry.ReadStoreGeneratedValue(2); + } + else + { + { + if (entry.FlaggedAsTemporary(2) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null) == null) + { + return entry.ReadTemporaryValue(2); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsId") ? ((Dictionary)entry.Entity)["PrincipalsId"] : null; + return nullableValue == null ? default(long) : (long)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsId, 2), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsId, 2), + (ValueBuffer valueBuffer) => valueBuffer[2]); + principalsId.SetPropertyIndexes( + index: 2, + originalValueIndex: 2, + shadowIndex: -1, + relationshipIndex: 2, + storeGenerationIndex: 2); principalsId.TypeMapping = LongTypeMapping.Default.Clone( comparer: new ValueComparer( (long v1, long v2) => v1 == v2, @@ -79,13 +218,60 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (long v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + principalsId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsId)); var principalsAlternateId = runtimeEntityType.AddProperty( "PrincipalsAlternateId", typeof(Guid), propertyInfo: runtimeEntityType.FindIndexerPropertyInfo(), afterSaveBehavior: PropertySaveBehavior.Throw); + principalsAlternateId.SetGetter( + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null), + (Dictionary entity) => (entity.ContainsKey("PrincipalsAlternateId") ? entity["PrincipalsAlternateId"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null ? new Guid("00000000-0000-0000-0000-000000000000") : (Guid)(instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null), + (Dictionary instance) => (instance.ContainsKey("PrincipalsAlternateId") ? instance["PrincipalsAlternateId"] : null) == null); + principalsAlternateId.SetSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetMaterializationSetter( + (Dictionary entity, Guid value) => entity["PrincipalsAlternateId"] = (object)value); + principalsAlternateId.SetAccessors( + (InternalEntityEntry entry) => + { + if (entry.FlaggedAsStoreGenerated(3)) + { + return entry.ReadStoreGeneratedValue(3); + } + else + { + { + if (entry.FlaggedAsTemporary(3) && (((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null) == null) + { + return entry.ReadTemporaryValue(3); + } + else + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + } + } + } + }, + (InternalEntityEntry entry) => + { + var nullableValue = ((Dictionary)entry.Entity).ContainsKey("PrincipalsAlternateId") ? ((Dictionary)entry.Entity)["PrincipalsAlternateId"] : null; + return nullableValue == null ? default(Guid) : (Guid)nullableValue; + }, + (InternalEntityEntry entry) => entry.ReadOriginalValue(principalsAlternateId, 3), + (InternalEntityEntry entry) => entry.ReadRelationshipSnapshotValue(principalsAlternateId, 3), + (ValueBuffer valueBuffer) => valueBuffer[3]); + principalsAlternateId.SetPropertyIndexes( + index: 3, + originalValueIndex: 3, + shadowIndex: -1, + relationshipIndex: 3, + storeGenerationIndex: 3); principalsAlternateId.TypeMapping = SqliteGuidTypeMapping.Default; + principalsAlternateId.SetCurrentValueComparer(new EntryCurrentValueComparer(principalsAlternateId)); var rowid = runtimeEntityType.AddProperty( "rowid", @@ -96,19 +282,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAddOrUpdate, beforeSaveBehavior: PropertySaveBehavior.Ignore, afterSaveBehavior: PropertySaveBehavior.Ignore); + rowid.SetGetter( + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null ? null : (byte[])(entity.ContainsKey("rowid") ? entity["rowid"] : null), + (Dictionary entity) => (entity.ContainsKey("rowid") ? entity["rowid"] : null) == null, + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null ? null : (byte[])(instance.ContainsKey("rowid") ? instance["rowid"] : null), + (Dictionary instance) => (instance.ContainsKey("rowid") ? instance["rowid"] : null) == null); + rowid.SetSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetMaterializationSetter( + (Dictionary entity, byte[] value) => entity["rowid"] = (object)value); + rowid.SetAccessors( + (InternalEntityEntry entry) => entry.FlaggedAsStoreGenerated(4) ? entry.ReadStoreGeneratedValue(4) : entry.FlaggedAsTemporary(4) && (((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null) == null ? entry.ReadTemporaryValue(4) : (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => (byte[])(((Dictionary)entry.Entity).ContainsKey("rowid") ? ((Dictionary)entry.Entity)["rowid"] : null), + (InternalEntityEntry entry) => entry.ReadOriginalValue(rowid, 4), + (InternalEntityEntry entry) => entry.GetCurrentValue(rowid), + (ValueBuffer valueBuffer) => valueBuffer[4]); + rowid.SetPropertyIndexes( + index: 4, + originalValueIndex: 4, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: 4); rowid.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var key = runtimeEntityType.AddKey( new[] { derivedsId, derivedsAlternateId, principalsId, principalsAlternateId }); @@ -144,6 +351,39 @@ public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEnt public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var derivedsId = runtimeEntityType.FindProperty("DerivedsId")!; + var derivedsAlternateId = runtimeEntityType.FindProperty("DerivedsAlternateId")!; + var principalsId = runtimeEntityType.FindProperty("PrincipalsId")!; + var principalsAlternateId = runtimeEntityType.FindProperty("PrincipalsAlternateId")!; + var rowid = runtimeEntityType.FindProperty("rowid")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId)), source.GetCurrentValue(rowid) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(source.GetCurrentValue(rowid))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)derivedsAlternateId.GetValueComparer()).Snapshot(default(Guid)), ((ValueComparer)principalsId.GetValueComparer()).Snapshot(default(long)), ((ValueComparer)principalsAlternateId.GetValueComparer()).Snapshot(default(Guid)), default(byte[]) == null ? null : ((ValueComparer)rowid.GetValueComparer()).Snapshot(default(byte[])))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(long), default(Guid), default(long), default(Guid), default(byte[]))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (Dictionary)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)derivedsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsId)), ((ValueComparer)derivedsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(derivedsAlternateId)), ((ValueComparer)principalsId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsId)), ((ValueComparer)principalsAlternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(principalsAlternateId))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 5, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 5, + shadowCount: 0, + relationshipCount: 4, + storeGeneratedCount: 5); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs index 4c3093adac0..a5e08b87de1 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel_with_JSON_columns/PrincipalDerivedEntityType.cs @@ -1,9 +1,15 @@ // using System; using System.Collections.Generic; +using System.Net; using System.Reflection; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; +using NetTopologySuite.Geometries; #pragma warning disable 219, 612, 618 #nullable disable @@ -40,9 +46,7 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl false, typeof(ICollection), propertyInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetProperty("Principals", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), - fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), - eagerLoaded: true, - lazyLoadingEnabled: false); + fieldInfo: typeof(CompiledModelTestBase.PrincipalDerived>).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); var inverse = targetEntityType.FindSkipNavigation("Deriveds"); if (inverse != null) @@ -51,11 +55,85 @@ public static RuntimeSkipNavigation CreateSkipNavigation1(RuntimeEntityType decl inverse.Inverse = skipNavigation; } + skipNavigation.SetGetter( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity) == null, + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance), + (CompiledModelTestBase.PrincipalDerived>> instance) => ReadPrincipals(instance) == null); + skipNavigation.SetSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetMaterializationSetter( + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection value) => WritePrincipals(entity, value)); + skipNavigation.SetAccessors( + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + (InternalEntityEntry entry) => ReadPrincipals((CompiledModelTestBase.PrincipalDerived>>)entry.Entity), + null, + (InternalEntityEntry entry) => entry.GetCurrentValue>(skipNavigation), + null); + skipNavigation.SetPropertyIndexes( + index: 4, + originalValueIndex: -1, + shadowIndex: -1, + relationshipIndex: 6, + storeGenerationIndex: -1); + skipNavigation.SetCollectionAccessor>, ICollection, CompiledModelTestBase.PrincipalBase>( + (CompiledModelTestBase.PrincipalDerived>> entity) => ReadPrincipals(entity), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, ICollection collection) => WritePrincipals(entity, (ICollection)collection), + (CompiledModelTestBase.PrincipalDerived>> entity, Action>>, ICollection> setter) => ClrCollectionAccessorFactory.CreateAndSetHashSet>>, ICollection, CompiledModelTestBase.PrincipalBase>(entity, setter), + () => (ICollection)(ICollection)new HashSet(ReferenceEqualityComparer.Instance)); return skipNavigation; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var alternateId = runtimeEntityType.FindProperty("AlternateId")!; + var discriminator = runtimeEntityType.FindProperty("Discriminator")!; + var enum1 = runtimeEntityType.FindProperty("Enum1")!; + var enum2 = runtimeEntityType.FindProperty("Enum2")!; + var flagsEnum1 = runtimeEntityType.FindProperty("FlagsEnum1")!; + var flagsEnum2 = runtimeEntityType.FindProperty("FlagsEnum2")!; + var point = runtimeEntityType.FindProperty("Point")!; + var refTypeArray = runtimeEntityType.FindProperty("RefTypeArray")!; + var refTypeEnumerable = runtimeEntityType.FindProperty("RefTypeEnumerable")!; + var refTypeIList = runtimeEntityType.FindProperty("RefTypeIList")!; + var refTypeList = runtimeEntityType.FindProperty("RefTypeList")!; + var valueTypeArray = runtimeEntityType.FindProperty("ValueTypeArray")!; + var valueTypeEnumerable = runtimeEntityType.FindProperty("ValueTypeEnumerable")!; + var valueTypeIList = runtimeEntityType.FindProperty("ValueTypeIList")!; + var valueTypeList = runtimeEntityType.FindProperty("ValueTypeList")!; + var owned = runtimeEntityType.FindNavigation("Owned")!; + var dependent = runtimeEntityType.FindNavigation("Dependent")!; + var manyOwned = runtimeEntityType.FindNavigation("ManyOwned")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, string, CompiledModelTestBase.AnEnum, Nullable, CompiledModelTestBase.AFlagsEnum, CompiledModelTestBase.AFlagsEnum, Point, IPAddress[], IEnumerable, IList, List, DateTime[], IEnumerable, IList, List>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), source.GetCurrentValue(discriminator) == null ? null : ((ValueComparer)discriminator.GetValueComparer()).Snapshot(source.GetCurrentValue(discriminator)), ((ValueComparer)enum1.GetValueComparer()).Snapshot(source.GetCurrentValue(enum1)), source.GetCurrentValue>(enum2) == null ? null : ((ValueComparer>)enum2.GetValueComparer()).Snapshot(source.GetCurrentValue>(enum2)), ((ValueComparer)flagsEnum1.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum1)), ((ValueComparer)flagsEnum2.GetValueComparer()).Snapshot(source.GetCurrentValue(flagsEnum2)), source.GetCurrentValue(point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(source.GetCurrentValue(point)), (IEnumerable)source.GetCurrentValue(refTypeArray) == null ? null : (IPAddress[])((ValueComparer>)refTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(refTypeArray)), source.GetCurrentValue>(refTypeEnumerable) == null ? null : ((ValueComparer>)refTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(refTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(refTypeIList) == null ? null : (IList)((ValueComparer>)refTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeIList)), (IEnumerable)source.GetCurrentValue>(refTypeList) == null ? null : (List)((ValueComparer>)refTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(refTypeList)), (IEnumerable)source.GetCurrentValue(valueTypeArray) == null ? null : (DateTime[])((ValueComparer>)valueTypeArray.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue(valueTypeArray)), source.GetCurrentValue>(valueTypeEnumerable) == null ? null : ((ValueComparer>)valueTypeEnumerable.GetValueComparer()).Snapshot(source.GetCurrentValue>(valueTypeEnumerable)), (IEnumerable)source.GetCurrentValue>(valueTypeIList) == null ? null : (IList)((ValueComparer>)valueTypeIList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeIList)), (IEnumerable)source.GetCurrentValue>(valueTypeList) == null ? null : (List)((ValueComparer>)valueTypeList.GetValueComparer()).Snapshot((IEnumerable)source.GetCurrentValue>(valueTypeList))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(default(Point) == null ? null : ((ValueComparer)point.GetValueComparer()).Snapshot(default(Point)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(Point))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Discriminator") ? (string)source["Discriminator"] : null, source.ContainsKey("Point") ? (Point)source["Point"] : null)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(string), default(Point))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.PrincipalDerived>>)source.Entity; + return (ISnapshot)new Snapshot, Guid, object, object, object, object, object>(source.GetCurrentValue>(id) == null ? null : ((ValueComparer>)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue>(id)), ((ValueComparer)alternateId.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(alternateId)), PrincipalBaseEntityType.ReadOwned(entity), null, ReadDependent(entity), SnapshotFactoryFactory.SnapshotCollection(ReadManyOwned(entity)), null); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 16, + navigationCount: 5, + complexPropertyCount: 0, + originalValueCount: 16, + shadowCount: 2, + relationshipCount: 7, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -67,5 +145,32 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref ICollection GetPrincipals(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadPrincipals(CompiledModelTestBase.PrincipalDerived> @this) + => GetPrincipals(@this); + + public static void WritePrincipals(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetPrincipals(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref CompiledModelTestBase.DependentBase GetDependent(CompiledModelTestBase.PrincipalDerived> @this); + + public static CompiledModelTestBase.DependentBase ReadDependent(CompiledModelTestBase.PrincipalDerived> @this) + => GetDependent(@this); + + public static void WriteDependent(CompiledModelTestBase.PrincipalDerived> @this, CompiledModelTestBase.DependentBase value) + => GetDependent(@this) = value; + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "ManyOwned")] + extern static ref ICollection GetManyOwned(CompiledModelTestBase.PrincipalDerived> @this); + + public static ICollection ReadManyOwned(CompiledModelTestBase.PrincipalDerived> @this) + => GetManyOwned(@this); + + public static void WriteManyOwned(CompiledModelTestBase.PrincipalDerived> @this, ICollection value) + => GetManyOwned(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs index a0cb6fe06e0..1db211f6b7b 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/CheckConstraints/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -46,6 +56,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -53,19 +64,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var key = runtimeEntityType.AddKey( new[] { id }); @@ -76,6 +108,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -87,5 +149,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs index eb23d1c3a21..11c26f0834b 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/DataEntityType.cs @@ -1,12 +1,17 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; #pragma warning disable 219, 612, 618 #nullable disable @@ -29,25 +34,71 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 0), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[0]); + blob.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); return runtimeEntityType; } public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 1, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 1, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", "Microsoft.EntityFrameworkCore.Scaffolding.CompiledModelRelationalTestBase+DbFunctionContext.GetData()"); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -59,5 +110,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs index ffdea2f1274..dcdc1169e43 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/DbFunctions/ObjectEntityType.cs @@ -1,7 +1,10 @@ // using System; +using System.Collections.Generic; using System.Reflection; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; #pragma warning disable 219, 612, 618 #nullable disable @@ -23,6 +26,26 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => Snapshot.Empty); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => Snapshot.Empty); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => Snapshot.Empty); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 0, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 0, + shadowCount: 0, + relationshipCount: 0, + storeGeneratedCount: 0); runtimeEntityType.AddAnnotation("Relational:FunctionName", "GetBlobs()"); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs index a0cb6fe06e0..1db211f6b7b 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Dynamic_schema/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -46,6 +56,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -53,19 +64,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var key = runtimeEntityType.AddKey( new[] { id }); @@ -76,6 +108,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -87,5 +149,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs index d5be7b08c6f..92edf134a77 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/Triggers/DataEntityType.cs @@ -1,10 +1,14 @@ // using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; @@ -31,6 +35,12 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas valueGenerated: ValueGenerated.OnAdd, afterSaveBehavior: PropertySaveBehavior.Throw, sentinel: 0); + id.SetPropertyIndexes( + index: 0, + originalValueIndex: 0, + shadowIndex: 0, + relationshipIndex: 0, + storeGenerationIndex: 0); id.TypeMapping = IntTypeMapping.Default.Clone( comparer: new ValueComparer( (int v1, int v2) => v1 == v2, @@ -46,6 +56,7 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas (int v) => v), mappingInfo: new RelationalTypeMappingInfo( storeTypeName: "INTEGER")); + id.SetCurrentValueComparer(new EntryCurrentValueComparer(id)); var blob = runtimeEntityType.AddProperty( "Blob", @@ -53,19 +64,40 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas propertyInfo: typeof(CompiledModelTestBase.Data).GetProperty("Blob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), fieldInfo: typeof(CompiledModelTestBase.Data).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), nullable: true); + blob.SetGetter( + (CompiledModelTestBase.Data entity) => ReadBlob(entity), + (CompiledModelTestBase.Data entity) => ReadBlob(entity) == null, + (CompiledModelTestBase.Data instance) => ReadBlob(instance), + (CompiledModelTestBase.Data instance) => ReadBlob(instance) == null); + blob.SetSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetMaterializationSetter( + (CompiledModelTestBase.Data entity, byte[] value) => WriteBlob(entity, value)); + blob.SetAccessors( + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => ReadBlob((CompiledModelTestBase.Data)entry.Entity), + (InternalEntityEntry entry) => entry.ReadOriginalValue(blob, 1), + (InternalEntityEntry entry) => entry.GetCurrentValue(blob), + (ValueBuffer valueBuffer) => valueBuffer[1]); + blob.SetPropertyIndexes( + index: 1, + originalValueIndex: 1, + shadowIndex: -1, + relationshipIndex: -1, + storeGenerationIndex: -1); blob.TypeMapping = SqliteByteArrayTypeMapping.Default.Clone( comparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => v.GetHashCode(), - (Byte[] v) => v), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => v.GetHashCode(), + (byte[] v) => v), keyComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray()), + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray()), providerValueComparer: new ValueComparer( - (Byte[] v1, Byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), - (Byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), - (Byte[] source) => source.ToArray())); + (byte[] v1, byte[] v2) => StructuralComparisons.StructuralEqualityComparer.Equals((object)v1, (object)v2), + (byte[] v) => StructuralComparisons.StructuralEqualityComparer.GetHashCode((object)v), + (byte[] source) => source.ToArray())); var key = runtimeEntityType.AddKey( new[] { id }); @@ -82,6 +114,36 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) { + var id = runtimeEntityType.FindProperty("Id")!; + var blob = runtimeEntityType.FindProperty("Blob")!; + runtimeEntityType.SetOriginalValuesFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(source.GetCurrentValue(id)), source.GetCurrentValue(blob) == null ? null : ((ValueComparer)blob.GetValueComparer()).Snapshot(source.GetCurrentValue(blob))); + }); + runtimeEntityType.SetStoreGeneratedValuesFactory( + () => (ISnapshot)new Snapshot(((ValueComparer)id.GetValueComparer()).Snapshot(default(int)))); + runtimeEntityType.SetTemporaryValuesFactory( + (InternalEntityEntry source) => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetShadowValuesFactory( + (IDictionary source) => (ISnapshot)new Snapshot(source.ContainsKey("Id") ? (int)source["Id"] : 0)); + runtimeEntityType.SetEmptyShadowValuesFactory( + () => (ISnapshot)new Snapshot(default(int))); + runtimeEntityType.SetRelationshipSnapshotFactory( + (InternalEntityEntry source) => + { + var entity = (CompiledModelTestBase.Data)source.Entity; + return (ISnapshot)new Snapshot(((ValueComparer)id.GetKeyValueComparer()).Snapshot(source.GetCurrentValue(id))); + }); + runtimeEntityType.Counts = new PropertyCounts( + propertyCount: 2, + navigationCount: 0, + complexPropertyCount: 0, + originalValueCount: 2, + shadowCount: 1, + relationshipCount: 1, + storeGeneratedCount: 1); runtimeEntityType.AddAnnotation("Relational:FunctionName", null); runtimeEntityType.AddAnnotation("Relational:Schema", null); runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); @@ -93,5 +155,14 @@ public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) } static partial void Customize(RuntimeEntityType runtimeEntityType); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "k__BackingField")] + extern static ref byte[] GetBlob(CompiledModelTestBase.Data @this); + + public static byte[] ReadBlob(CompiledModelTestBase.Data @this) + => GetBlob(@this); + + public static void WriteBlob(CompiledModelTestBase.Data @this, byte[] value) + => GetBlob(@this) = value; } } diff --git a/test/EFCore.Tests/ChangeTracking/Internal/CurrentValueComparerTest.cs b/test/EFCore.Tests/ChangeTracking/Internal/CurrentValueComparerTest.cs index 827bc3d35e0..4126d2d8214 100644 --- a/test/EFCore.Tests/ChangeTracking/Internal/CurrentValueComparerTest.cs +++ b/test/EFCore.Tests/ChangeTracking/Internal/CurrentValueComparerTest.cs @@ -37,7 +37,7 @@ public void Factory_creates_expected_comparer(Type expectedComparer, string prop { using var context = new GodzillaContext(); - var factory = new CurrentValueComparerFactory(); + var factory = CurrentValueComparerFactory.Instance; Assert.IsType(expectedComparer, factory.Create(context.Model.FindEntityType(typeof(Godzilla)).FindProperty(property))); } @@ -47,7 +47,7 @@ public void Factory_throws_if_provider_type_is_not_comparable() { using var context = new GodzillaContext(); - var factory = new CurrentValueComparerFactory(); + var factory = CurrentValueComparerFactory.Instance; Assert.Equal( CoreStrings.NonComparableKeyType( @@ -62,7 +62,7 @@ public void Factory_throws_if_model_and_provider_type_are_not_comparable() { using var context = new GodzillaContext(); - var factory = new CurrentValueComparerFactory(); + var factory = CurrentValueComparerFactory.Instance; Assert.Equal( CoreStrings.NonComparableKeyTypes( diff --git a/test/EFCore.Tests/DbSetInitializerTest.cs b/test/EFCore.Tests/DbSetInitializerTest.cs index 132a21e8029..f9d9559f434 100644 --- a/test/EFCore.Tests/DbSetInitializerTest.cs +++ b/test/EFCore.Tests/DbSetInitializerTest.cs @@ -32,7 +32,7 @@ private class FakeSetFinder : IDbSetFinder { public IReadOnlyList FindSets(Type contextType) { - var setterFactory = new ClrPropertySetterFactory(); + var setterFactory = ClrPropertySetterFactory.Instance; return new[] { diff --git a/test/EFCore.Tests/Metadata/Internal/ClrCollectionAccessorFactoryTest.cs b/test/EFCore.Tests/Metadata/Internal/ClrCollectionAccessorFactoryTest.cs index c7c71516e2c..2d35b1463d4 100644 --- a/test/EFCore.Tests/Metadata/Internal/ClrCollectionAccessorFactoryTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/ClrCollectionAccessorFactoryTest.cs @@ -127,7 +127,7 @@ private void AccessorTest( Func> reader, bool initializeCollections = true) { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation(navigationName)); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation(navigationName)); var entity = new MyEntity(initializeCollections); @@ -165,7 +165,7 @@ public void Delegate_accessor_always_creates_collections_that_use_reference_equa RunConvention(navigation); - var accessor = new ClrCollectionAccessorFactory().Create((INavigation)navigation); + var accessor = ClrCollectionAccessorFactory.Instance.Create((INavigation)navigation); var entity = new MyEntity(initialize: false); var value = new MyEntityWithCustomComparer { Id = 1 }; @@ -188,7 +188,7 @@ public void Creating_accessor_for_navigation_without_getter_and_no_backing_field Assert.Equal( CoreStrings.NoFieldOrGetter("WriteOnlyPropNoField", typeof(MyEntity).Name), - Assert.Throws(() => new ClrCollectionAccessorFactory().Create(navigation)).Message); + Assert.Throws(() => ClrCollectionAccessorFactory.Instance.Create(navigation)).Message); } [ConditionalFact] @@ -209,7 +209,7 @@ public void GetOrCreate_for_enumerable_backed_by_non_collection_throws() private void Enumerable_backed_by_non_collection_throws(Action test) { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("AsIEnumerableNotCollection")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("AsIEnumerableNotCollection")); var entity = new MyEntity(initialize: true); var value = new MyOtherEntity(); @@ -227,13 +227,13 @@ public void Creating_accessor_for_array_navigation_throws() Assert.Equal( CoreStrings.NavigationArray("AsArray", typeof(MyEntity).Name, typeof(MyOtherEntity[]).Name), - Assert.Throws(() => new ClrCollectionAccessorFactory().Create(navigation)).Message); + Assert.Throws(() => ClrCollectionAccessorFactory.Instance.Create(navigation)).Message); } [ConditionalFact] public void Initialization_for_navigation_without_backing_field_throws() { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("NoBackingFound")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("NoBackingFound")); Assert.Equal( CoreStrings.NavigationNoSetter("NoBackingFound", typeof(MyEntity).Name), @@ -244,7 +244,7 @@ public void Initialization_for_navigation_without_backing_field_throws() [ConditionalFact] public void Initialization_for_read_only_navigation_without_backing_field_throws() { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("ReadOnlyPropNoField")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("ReadOnlyPropNoField")); Assert.Equal( CoreStrings.NavigationNoSetter("ReadOnlyPropNoField", typeof(MyEntity).Name), @@ -263,7 +263,7 @@ public void Initialization_for_read_only_navigation_backed_by_readonly_field() [ConditionalFact] public void Initialization_for_navigation_with_private_constructor_throws() { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("AsMyPrivateCollection")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("AsMyPrivateCollection")); Assert.Equal( CoreStrings.NavigationCannotCreateType("AsMyPrivateCollection", typeof(MyEntity).Name, typeof(MyPrivateCollection).Name), @@ -274,7 +274,7 @@ public void Initialization_for_navigation_with_private_constructor_throws() [ConditionalFact] public void Initialization_for_navigation_with_internal_constructor_throws() { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("AsMyInternalCollection")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("AsMyInternalCollection")); Assert.Equal( CoreStrings.NavigationCannotCreateType("AsMyInternalCollection", typeof(MyEntity).Name, typeof(MyInternalCollection).Name), @@ -285,7 +285,7 @@ public void Initialization_for_navigation_with_internal_constructor_throws() [ConditionalFact] public void Initialization_for_navigation_without_parameterless_constructor_throws() { - var accessor = new ClrCollectionAccessorFactory().Create(CreateNavigation("AsMyUnavailableCollection")); + var accessor = ClrCollectionAccessorFactory.Instance.Create(CreateNavigation("AsMyUnavailableCollection")); Assert.Equal( CoreStrings.NavigationCannotCreateType( diff --git a/test/EFCore.Tests/Metadata/Internal/ClrPropertyGetterFactoryTest.cs b/test/EFCore.Tests/Metadata/Internal/ClrPropertyGetterFactoryTest.cs index 916603cfb31..a94e97b752d 100644 --- a/test/EFCore.Tests/Metadata/Internal/ClrPropertyGetterFactoryTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/ClrPropertyGetterFactoryTest.cs @@ -14,7 +14,7 @@ public void Property_is_returned_if_it_implements_IClrPropertyGetter() { var property = new FakeProperty(); - Assert.Same(property, new ClrPropertyGetterFactory().Create(property)); + Assert.Same(property, ClrPropertyGetterFactory.Instance.Create(property)); } private class FakeProperty : Annotatable, IProperty, IClrPropertyGetter @@ -147,14 +147,14 @@ public void Delegate_getter_is_returned_for_IProperty_property() var idProperty = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Id)); Assert.Equal( - 7, new ClrPropertyGetterFactory().Create(idProperty).GetClrValueUsingContainingEntity( + 7, ClrPropertyGetterFactory.Instance.Create(idProperty).GetClrValueUsingContainingEntity( new Customer { Id = 7 })); } [ConditionalFact] public void Delegate_getter_is_returned_for_property_info() => Assert.Equal( - 7, new ClrPropertyGetterFactory().Create(typeof(Customer).GetAnyProperty("Id")).GetClrValueUsingContainingEntity( + 7, ClrPropertyGetterFactory.Instance.Create(typeof(Customer).GetAnyProperty("Id")).GetClrValueUsingContainingEntity( new Customer { Id = 7 })); [ConditionalFact] @@ -167,7 +167,7 @@ public void Delegate_getter_is_returned_for_IProperty_struct_property() Assert.Equal( new Fuel(1.0), - new ClrPropertyGetterFactory().Create((IPropertyBase)fuelProperty).GetClrValueUsingContainingEntity( + ClrPropertyGetterFactory.Instance.Create((IPropertyBase)fuelProperty).GetClrValueUsingContainingEntity( new Customer { Id = 7, Fuel = new Fuel(1.0) })); } @@ -175,7 +175,7 @@ public void Delegate_getter_is_returned_for_IProperty_struct_property() public void Delegate_getter_is_returned_for_struct_property_info() => Assert.Equal( new Fuel(1.0), - new ClrPropertyGetterFactory().Create(typeof(Customer).GetAnyProperty("Fuel")).GetClrValueUsingContainingEntity( + ClrPropertyGetterFactory.Instance.Create(typeof(Customer).GetAnyProperty("Fuel")).GetClrValueUsingContainingEntity( new Customer { Id = 7, Fuel = new Fuel(1.0) })); [ConditionalFact] @@ -189,10 +189,10 @@ public void Delegate_getter_is_returned_for_index_property() Assert.Equal( "ValueA", - new ClrPropertyGetterFactory().Create((IPropertyBase)propertyA).GetClrValueUsingContainingEntity(new IndexedClass { Id = 7 })); + ClrPropertyGetterFactory.Instance.Create((IPropertyBase)propertyA).GetClrValueUsingContainingEntity(new IndexedClass { Id = 7 })); Assert.Equal( 123, - new ClrPropertyGetterFactory().Create((IPropertyBase)propertyB).GetClrValueUsingContainingEntity(new IndexedClass { Id = 7 })); + ClrPropertyGetterFactory.Instance.Create((IPropertyBase)propertyB).GetClrValueUsingContainingEntity(new IndexedClass { Id = 7 })); } [ConditionalFact] @@ -213,11 +213,11 @@ public void Delegate_getter_is_returned_for_IProperty_complex_property() .ComplexType.FindProperty(nameof(Fuel.Volume))!; Assert.Equal( - 10.0, new ClrPropertyGetterFactory().Create(volumeProperty).GetClrValueUsingContainingEntity( + 10.0, ClrPropertyGetterFactory.Instance.Create(volumeProperty).GetClrValueUsingContainingEntity( new Customer { Id = 7, Fuel = new Fuel(10.0) })); Assert.Equal( - 10.0, new ClrPropertyGetterFactory().Create(volumeProperty).GetClrValue(new Fuel(10.0))); + 10.0, ClrPropertyGetterFactory.Instance.Create(volumeProperty).GetClrValue(new Fuel(10.0))); } private static TestHelpers.TestModelBuilder CreateModelBuilder() diff --git a/test/EFCore.Tests/Metadata/Internal/ClrPropertySetterFactoryTest.cs b/test/EFCore.Tests/Metadata/Internal/ClrPropertySetterFactoryTest.cs index ea2439a7ab8..4667ce585b3 100644 --- a/test/EFCore.Tests/Metadata/Internal/ClrPropertySetterFactoryTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/ClrPropertySetterFactoryTest.cs @@ -16,7 +16,7 @@ public void Property_is_returned_if_it_implements_IClrPropertySetter() { var property = new FakeProperty(); - Assert.Same(property, new ClrPropertySetterFactory().Create(property)); + Assert.Same(property, ClrPropertySetterFactory.Instance.Create(property)); } private class FakeProperty : Annotatable, IProperty, IClrPropertySetter @@ -141,7 +141,7 @@ public void Delegate_setter_is_returned_for_IProperty_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, 77); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, 77); Assert.Equal(77, customer.Id); } @@ -151,7 +151,7 @@ public void Delegate_setter_is_returned_for_property_type_and_name() { var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create(typeof(Customer).GetAnyProperty("Id")).SetClrValue(customer, 77); + ClrPropertySetterFactory.Instance.Create(typeof(Customer).GetAnyProperty("Id")).SetClrValue(customer, 77); Assert.Equal(77, customer.Id); } @@ -164,7 +164,7 @@ public void Delegate_setter_can_set_value_type_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, 1); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, 1); Assert.Equal(1, customer.Id); } @@ -177,7 +177,7 @@ public void Delegate_setter_can_set_reference_type_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, "MyString"); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, "MyString"); Assert.Equal("MyString", customer.Content); } @@ -190,7 +190,7 @@ public void Delegate_setter_can_set_nullable_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, 3); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, 3); Assert.Equal(3, customer.OptionalInt); } @@ -203,7 +203,7 @@ public void Delegate_setter_can_set_nullable_property_with_null_value() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, null); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, null); Assert.Null(customer.OptionalInt); } @@ -216,7 +216,7 @@ public void Delegate_setter_can_set_enum_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, Flag.One); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, Flag.One); Assert.Equal(Flag.One, customer.Flag); } @@ -229,7 +229,7 @@ public void Delegate_setter_can_set_nullable_enum_property() var customer = new Customer { Id = 7 }; - new ClrPropertySetterFactory().Create((IProperty)idProperty).SetClrValue(customer, Flag.Two); + ClrPropertySetterFactory.Instance.Create((IProperty)idProperty).SetClrValue(customer, Flag.Two); Assert.Equal(Flag.Two, customer.OptionalFlag); } @@ -242,7 +242,7 @@ public void Delegate_setter_can_set_on_virtual_privatesetter_property_override_s typeof(ConcreteEntity1).GetProperty(nameof(ConcreteEntity1.VirtualPrivateProperty_Override))); var entity = new ConcreteEntity1(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.VirtualPrivateProperty_Override); } @@ -254,7 +254,7 @@ public void Delegate_setter_can_set_on_virtual_privatesetter_property_override_m typeof(ConcreteEntity2).GetProperty(nameof(ConcreteEntity2.VirtualPrivateProperty_Override))); var entity = new ConcreteEntity2(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.VirtualPrivateProperty_Override); } @@ -266,7 +266,7 @@ public void Delegate_setter_can_set_on_virtual_privatesetter_property_no_overrid typeof(ConcreteEntity1).GetProperty(nameof(ConcreteEntity1.VirtualPrivateProperty_NoOverride))); var entity = new ConcreteEntity1(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.VirtualPrivateProperty_NoOverride); } @@ -278,7 +278,7 @@ public void Delegate_setter_can_set_on_virtual_privatesetter_property_no_overrid typeof(ConcreteEntity2).GetProperty(nameof(ConcreteEntity2.VirtualPrivateProperty_NoOverride))); var entity = new ConcreteEntity2(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.VirtualPrivateProperty_NoOverride); } @@ -289,7 +289,7 @@ public void Delegate_setter_can_set_on_privatesetter_property_singlebasetype() var property = entityType.AddProperty(typeof(ConcreteEntity1).GetProperty(nameof(ConcreteEntity1.PrivateProperty))); var entity = new ConcreteEntity1(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.PrivateProperty); } @@ -300,7 +300,7 @@ public void Delegate_setter_can_set_on_privatesetter_property_multiplebasetypes( var property = entityType.AddProperty(typeof(ConcreteEntity2).GetProperty(nameof(ConcreteEntity2.PrivateProperty))); var entity = new ConcreteEntity2(); - new ClrPropertySetterFactory().Create((IProperty)property).SetClrValue(entity, 100); + ClrPropertySetterFactory.Instance.Create((IProperty)property).SetClrValue(entity, 100); Assert.Equal(100, entity.PrivateProperty); } @@ -311,13 +311,13 @@ public void Delegate_setter_throws_if_no_setter_found() var property = entityType.AddProperty(typeof(ConcreteEntity1).GetProperty(nameof(ConcreteEntity1.NoSetterProperty))); Assert.Throws( - () => new ClrPropertySetterFactory().Create((IProperty)property)); + () => ClrPropertySetterFactory.Instance.Create((IProperty)property)); entityType = CreateModel().AddEntityType(typeof(ConcreteEntity2)); property = entityType.AddProperty(typeof(ConcreteEntity2).GetProperty(nameof(ConcreteEntity2.NoSetterProperty))); Assert.Throws( - () => new ClrPropertySetterFactory().Create((IProperty)property)); + () => ClrPropertySetterFactory.Instance.Create((IProperty)property)); } [ConditionalFact] @@ -332,8 +332,8 @@ public void Delegate_setter_can_set_index_properties() Assert.Equal("ValueA", indexedClass["PropertyA"]); Assert.Equal(123, indexedClass["PropertyB"]); - new ClrPropertySetterFactory().Create((IProperty)propertyA).SetClrValue(indexedClass, "UpdatedValue"); - new ClrPropertySetterFactory().Create((IProperty)propertyB).SetClrValue(indexedClass, 42); + ClrPropertySetterFactory.Instance.Create((IProperty)propertyA).SetClrValue(indexedClass, "UpdatedValue"); + ClrPropertySetterFactory.Instance.Create((IProperty)propertyB).SetClrValue(indexedClass, 42); Assert.Equal("UpdatedValue", indexedClass["PropertyA"]); Assert.Equal(42, indexedClass["PropertyB"]); diff --git a/test/EFCore.Tests/Metadata/Internal/CollectionTypeFactoryTest.cs b/test/EFCore.Tests/Metadata/Internal/CollectionTypeFactoryTest.cs index 591b4b9fc70..6a87188c3b8 100644 --- a/test/EFCore.Tests/Metadata/Internal/CollectionTypeFactoryTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/CollectionTypeFactoryTest.cs @@ -11,7 +11,7 @@ public class CollectionTypeFactoryTest [ConditionalFact] public void Returns_given_type_if_public_parameterless_constructor_available() { - var factory = new CollectionTypeFactory(); + var factory = CollectionTypeFactory.Instance; Assert.Same(typeof(CustomHashSet), factory.TryFindTypeToInstantiate(typeof(object), typeof(CustomHashSet), false)); Assert.Same(typeof(CustomList), factory.TryFindTypeToInstantiate(typeof(object), typeof(CustomList), false)); @@ -29,18 +29,18 @@ public void Returns_given_type_if_public_parameterless_constructor_available() public void Returns_ObservableHashSet_if_notifying_and_assignable() => Assert.Same( typeof(ObservableHashSet), - new CollectionTypeFactory().TryFindTypeToInstantiate(typeof(DummyNotifying), typeof(ICollection), false)); + CollectionTypeFactory.Instance.TryFindTypeToInstantiate(typeof(DummyNotifying), typeof(ICollection), false)); [ConditionalFact] public void Returns_ObservableHashSet_if_full_notification_required() => Assert.Same( typeof(ObservableHashSet), - new CollectionTypeFactory().TryFindTypeToInstantiate(typeof(object), typeof(ICollection), true)); + CollectionTypeFactory.Instance.TryFindTypeToInstantiate(typeof(object), typeof(ICollection), true)); [ConditionalFact] public void Returns_HashSet_if_assignable() { - var factory = new CollectionTypeFactory(); + var factory = CollectionTypeFactory.Instance; Assert.Same(typeof(HashSet), factory.TryFindTypeToInstantiate(typeof(object), typeof(ICollection), false)); Assert.Same(typeof(HashSet), factory.TryFindTypeToInstantiate(typeof(object), typeof(ISet), false)); @@ -51,12 +51,12 @@ public void Returns_HashSet_if_assignable() public void Returns_List_if_assignable() => Assert.Same( typeof(List), - new CollectionTypeFactory().TryFindTypeToInstantiate(typeof(object), typeof(IList), false)); + CollectionTypeFactory.Instance.TryFindTypeToInstantiate(typeof(object), typeof(IList), false)); [ConditionalFact] public void Returns_null_when_no_usable_concrete_type_found() { - var factory = new CollectionTypeFactory(); + var factory = CollectionTypeFactory.Instance; Assert.Null(factory.TryFindTypeToInstantiate(typeof(object), typeof(PrivateConstructor), false)); Assert.Null(factory.TryFindTypeToInstantiate(typeof(object), typeof(InternalConstructor), false)); diff --git a/test/EFCore.Tests/Metadata/Internal/PropertyAccessorsFactoryTest.cs b/test/EFCore.Tests/Metadata/Internal/PropertyAccessorsFactoryTest.cs index 0350a8fed80..dda25692ec4 100644 --- a/test/EFCore.Tests/Metadata/Internal/PropertyAccessorsFactoryTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/PropertyAccessorsFactoryTest.cs @@ -25,7 +25,7 @@ public void Can_use_PropertyAccessorsFactory_on_indexed_property() var entity = new IndexedClass(); var entry = new InternalEntityEntry(stateManager, (IEntityType)entityTypeBuilder.Metadata, entity); - var propertyAccessors = new PropertyAccessorsFactory().Create((IProperty)propertyA); + var propertyAccessors = PropertyAccessorsFactory.Instance.Create((IProperty)propertyA); Assert.Equal("ValueA", ((Func)propertyAccessors.CurrentValueGetter)(entry)); Assert.Equal("ValueA", ((Func)propertyAccessors.OriginalValueGetter)(entry)); Assert.Equal("ValueA", ((Func)propertyAccessors.PreStoreGeneratedCurrentValueGetter)(entry)); @@ -52,7 +52,7 @@ public void Can_use_PropertyAccessorsFactory_on_non_indexed_property() var entity = new NonIndexedClass(); var entry = new InternalEntityEntry(stateManager, (IEntityType)entityTypeBuilder.Metadata, entity); - var propertyAccessors = new PropertyAccessorsFactory().Create((IProperty)propA); + var propertyAccessors = PropertyAccessorsFactory.Instance.Create((IProperty)propA); Assert.Equal("ValueA", ((Func)propertyAccessors.CurrentValueGetter)(entry)); Assert.Equal("ValueA", ((Func)propertyAccessors.OriginalValueGetter)(entry)); Assert.Equal("ValueA", ((Func)propertyAccessors.PreStoreGeneratedCurrentValueGetter)(entry));