Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/EFCore.Cosmos/Extensions/CosmosDbFunctionsExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore.Cosmos.Extensions;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
1 change: 0 additions & 1 deletion src/EFCore.Cosmos/Extensions/CosmosIndexExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
1 change: 0 additions & 1 deletion src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/EFCore.Cosmos/Metadata/Internal/CosmosVectorType.cs
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;

namespace Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

// ReSharper disable once CheckNamespace

using System.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Microsoft.EntityFrameworkCore.Cosmos.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Storage.Json;
using Newtonsoft.Json.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1497,71 +1497,127 @@ private void
var variableName = parameters.TargetName;
var mainBuilder = parameters.MainBuilder;
var unsafeAccessors = new HashSet<string>();
var isOnComplexCollection = property.DeclaringType is IReadOnlyComplexType complexType && complexType.ComplexProperty.IsCollection;

if (!property.IsShadowProperty()
&& !isOnComplexCollection
&& property is not IServiceProperty) // Service properties don't use property accessors
{
ClrPropertyGetterFactory.Instance.Create(
property,
out var getterExpression,
out var hasSentinelExpression,
out var structuralGetterExpression,
out var hasStructuralSentinelExpression);
out var getClrValueUsingContainingEntityExpression,
out var hasSentinelValueUsingContainingEntityExpression,
out var getClrValueExpression,
out var hasSentinelValueExpression);

mainBuilder
.Append(variableName).AppendLine(".SetGetter(")
.IncrementIndent()
.AppendLines(
_code.Expression(
getterExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
hasSentinelExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.IncrementIndent();
if (property.DeclaringType is not IEntityType)
{
mainBuilder
.AppendLines(
_code.Expression(
getClrValueUsingContainingEntityExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
hasSentinelValueUsingContainingEntityExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",");
}
mainBuilder
.AppendLines(
_code.Expression(
structuralGetterExpression, parameters.Namespaces, unsafeAccessors,
getClrValueExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
hasStructuralSentinelExpression, parameters.Namespaces, unsafeAccessors,
hasSentinelValueExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(");")
.DecrementIndent();

ClrPropertySetterFactory.Instance.Create(property, out var setterExpression);
ClrPropertySetterFactory.Instance.Create(property, out var setterUsingContainingEntityExpression, out var setterExpression);

mainBuilder
.Append(variableName).AppendLine(".SetSetter(")
.IncrementIndent()
.IncrementIndent();
if (property.DeclaringType is not IEntityType)
{
mainBuilder
.AppendLines(
_code.Expression(
setterUsingContainingEntityExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",");
}
mainBuilder
.AppendLines(
_code.Expression(
setterExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(");")
.DecrementIndent();

ClrPropertyMaterializationSetterFactory.Instance.Create(property, out var materializationSetterExpression);
ClrPropertyMaterializationSetterFactory.Instance.Create(property, out var materializationSetterUsingContainingEntityExpression, out var materializationSetterExpression);

mainBuilder
.Append(variableName).AppendLine(".SetMaterializationSetter(")
.IncrementIndent()
.IncrementIndent();
if (property.DeclaringType is not IEntityType)
{
mainBuilder
.AppendLines(
_code.Expression(
materializationSetterUsingContainingEntityExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",");
}
mainBuilder
.AppendLines(
_code.Expression(
materializationSetterExpression, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(");")
.DecrementIndent();

if (property.IsCollection
&& property is IComplexProperty)
{
ClrIndexedCollectionAccessorFactory.Instance.Create(
property,
out _, out _, out _,
out var get, out var set, out var setForMaterialization, out var createCollection);

mainBuilder
.Append(variableName).AppendLine(".SetIndexedCollectionAccessor(")
.IncrementIndent()
.AppendLines(
_code.Expression(
get!, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
set!, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
setForMaterialization!, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(",")
.AppendLines(
_code.Expression(
createCollection!, parameters.Namespaces, unsafeAccessors,
(IReadOnlyDictionary<object, string>)parameters.ScopeVariables, memberAccessReplacements), skipFinalNewline: true)
.AppendLine(");")
.DecrementIndent();
}
}

if (property is not IServiceProperty
&& !isOnComplexCollection)
if (property is not IServiceProperty)
{
PropertyAccessorsFactory.Instance.Create(
property,
Expand Down Expand Up @@ -2967,7 +3023,8 @@ private static void CreateAnnotations<TAnnotatable>(
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
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Data;
using System.Reflection.Metadata;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

namespace Microsoft.EntityFrameworkCore.Infrastructure;
Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Metadata/Internal/JsonColumn.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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.Text.Json;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Metadata/Internal/JsonColumnBase.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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.Text.Json;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Metadata/Internal/JsonViewColumn.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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.Text.Json;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ private static void CreateContainerColumn<TColumnMappingBase>(
{
complexType = ((IComplexType)mappedType);
#pragma warning disable EF1001 // Internal EF Core API usage.
jsonColumn.IsNullable = complexType.ComplexProperty.IsNullable || complexType.ComplexProperty.GetChainToComplexProperty().Any(p => p.IsNullable);
jsonColumn.IsNullable = complexType.ComplexProperty.IsNullable || complexType.ComplexProperty.GetChainToComplexProperty(fromEntity: true).Any(p => p.IsNullable);
#pragma warning restore EF1001 // Internal EF Core API usage.
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Query/CacheSafeParameterFacade.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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;

namespace Microsoft.EntityFrameworkCore.Query;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;

namespace Microsoft.EntityFrameworkCore.Query;
Expand Down
1 change: 0 additions & 1 deletion src/EFCore.Relational/Query/SqlNullabilityProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.Storage;

namespace Microsoft.EntityFrameworkCore.Query;

Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Storage/RelationalCommandBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,8 +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.Text;

namespace Microsoft.EntityFrameworkCore.Storage;

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal;
using NetTopologySuite.Geometries;

namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +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.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.SqlServer.Internal;

namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +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;
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -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.Reflection.Metadata;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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.Text.Json;

namespace Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal;

/// <summary>
Expand Down
Loading