Skip to content

Commit

Permalink
Merge branch 'release/8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Jan 11, 2024
2 parents 93e0f3a + c153c95 commit 9a796b8
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 11 deletions.
2 changes: 1 addition & 1 deletion eng/common/templates/job/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))

- ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}:
- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1

- ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}:
- task: DownloadPipelineArtifact@2
Expand Down
2 changes: 1 addition & 1 deletion eng/common/templates/job/publish-build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
condition: ${{ parameters.condition }}
continueOnError: ${{ parameters.continueOnError }}

- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1

- task: PowerShell@2
displayName: Publish Build Assets
Expand Down
4 changes: 2 additions & 2 deletions eng/common/templates/post-build/post-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ stages:
# This is necessary whenever we want to publish/restore to an AzDO private feed
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
# otherwise it'll complain about accessing a private feed.
- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1
displayName: 'Authenticate to AzDO Feeds'

# Signing validation will optionally work with the buildmanifest file which is downloaded from
Expand Down Expand Up @@ -267,7 +267,7 @@ stages:
BARBuildId: ${{ parameters.BARBuildId }}
PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}

- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1

- task: PowerShell@2
displayName: Publish Using Darc
Expand Down
10 changes: 9 additions & 1 deletion eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,15 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' }

# Use override if it exists - commonly set by source-build
if ($null -eq $env:_OverrideArcadeInitializeBuildToolFramework) {
$initializeBuildToolFramework="net8.0"
} else {
$initializeBuildToolFramework=$env:_OverrideArcadeInitializeBuildToolFramework
}

$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = $initializeBuildToolFramework }
} elseif ($msbuildEngine -eq "vs") {
try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore/Metadata/Builders/OwnedNavigationBuilder`.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ public virtual PropertyBuilder<TProperty> Property<TProperty>(
/// <c>blog => blog.Url</c>).
/// </param>
/// <returns>An object that can be used to configure the property.</returns>
public virtual PropertyBuilder<TProperty> PrimitiveCollection<TProperty>(
public virtual PrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression)
=> UpdateBuilder(
() => new PropertyBuilder<TProperty>(
() => new PrimitiveCollectionBuilder<TProperty>(
DependentEntityType.Builder.PrimitiveCollection(
Check.NotNull(propertyExpression, nameof(propertyExpression)).GetMemberAccess(),
ConfigurationSource.Explicit)!.Metadata));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2182,6 +2182,22 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained()
.Entity<ComplexProperties>()
.ComplexProperty(e => e.CollectionQuarks)
.PrimitiveCollection(e => e.Up)
.ElementType(t => t
.HasAnnotation("B", "C")
.HasConversion(typeof(long))
.HasConversion(new CastingConverter<int, long>())
.HasConversion(typeof(long), typeof(CustomValueComparer<int>))
.HasConversion(typeof(long), new CustomValueComparer<int>())
.HasConversion(new CastingConverter<int, long>())
.HasConversion(new CastingConverter<int, long>(), new CustomValueComparer<int>())
.HasConversion<long>()
.HasConversion<long>(new CustomValueComparer<int>())
.HasConversion<long, CustomValueComparer<int>>()
.HasMaxLength(2)
.HasPrecision(1)
.HasPrecision(1, 2)
.IsRequired()
.IsUnicode())
.IsRequired()
.HasAnnotation("A", "V")
.IsConcurrencyToken()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,12 @@ protected class GenericTestComplexTypePrimitiveCollectionBuilder<TProperty>(Comp
public override IMutableProperty Metadata
=> PrimitiveCollectionBuilder.Metadata;

public override TestElementTypeBuilder ElementType()
=> new(PrimitiveCollectionBuilder.ElementType());

public override TestComplexTypePrimitiveCollectionBuilder<TProperty> ElementType(Action<TestElementTypeBuilder> builderAction)
=> Wrap(PrimitiveCollectionBuilder.ElementType(b => builderAction(new TestElementTypeBuilder(b))));

protected virtual TestComplexTypePrimitiveCollectionBuilder<TProperty> Wrap(
ComplexTypePrimitiveCollectionBuilder<TProperty> primitiveCollectionBuilder)
=> new GenericTestComplexTypePrimitiveCollectionBuilder<TProperty>(primitiveCollectionBuilder);
Expand Down Expand Up @@ -1376,6 +1382,13 @@ public override TestPropertyBuilder<TProperty> Property<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression)
=> Wrap(OwnedNavigationBuilder.Property(propertyExpression));

public override TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(string propertyName)
=> new GenericTestPrimitiveCollectionBuilder<TProperty>(OwnedNavigationBuilder.PrimitiveCollection<TProperty>(propertyName));

public override TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression)
=> new GenericTestPrimitiveCollectionBuilder<TProperty>(OwnedNavigationBuilder.PrimitiveCollection(propertyExpression));

public override TestNavigationBuilder Navigation<TNavigation>(
Expression<Func<TDependentEntity, TNavigation?>> navigationExpression)
where TNavigation : class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#nullable enable

using System.Reflection;

namespace Microsoft.EntityFrameworkCore.ModelBuilding;

public abstract partial class ModelBuilderTest
Expand Down Expand Up @@ -928,6 +930,12 @@ protected virtual TestComplexTypePrimitiveCollectionBuilder<TProperty> Wrap(
ComplexTypePrimitiveCollectionBuilder primitiveCollectionBuilder)
=> new NonGenericTestComplexTypePrimitiveCollectionBuilder<TProperty>(primitiveCollectionBuilder);

public override TestElementTypeBuilder ElementType()
=> new(PrimitiveCollectionBuilder.ElementType());

public override TestComplexTypePrimitiveCollectionBuilder<TProperty> ElementType(Action<TestElementTypeBuilder> builderAction)
=> Wrap(PrimitiveCollectionBuilder.ElementType(b => builderAction(new TestElementTypeBuilder(b))));

public override TestComplexTypePrimitiveCollectionBuilder<TProperty> HasAnnotation(string annotation, object? value)
=> Wrap(PrimitiveCollectionBuilder.HasAnnotation(annotation, value));

Expand Down Expand Up @@ -1442,6 +1450,17 @@ public override TestPropertyBuilder<TProperty> Property<TProperty>(
OwnedNavigationBuilder.Property(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName()));
}

public override TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(string propertyName)
=> new NonGenericTestPrimitiveCollectionBuilder<TProperty>(OwnedNavigationBuilder.PrimitiveCollection<TProperty>(propertyName));

public override TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression)
{
var memberInfo = propertyExpression.GetMemberAccess();
return new NonGenericTestPrimitiveCollectionBuilder<TProperty>(
OwnedNavigationBuilder.PrimitiveCollection(memberInfo.GetMemberType(), memberInfo.GetSimpleMemberName()));
}

public override TestNavigationBuilder Navigation<TNavigation>(
Expression<Func<TDependentEntity, TNavigation?>> navigationExpression)
where TNavigation : class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,24 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained()
=> CreateModelBuilder()
.Entity<CollectionQuarks>()
.PrimitiveCollection(e => e.Up)
.ElementType(t => t
.HasAnnotation("B", "C")
.HasConversion(typeof(long))
.HasConversion(new CastingConverter<int, long>())
.HasConversion(typeof(long), typeof(CustomValueComparer<int>))
.HasConversion(typeof(long), new CustomValueComparer<int>())
.HasConversion(new CastingConverter<int, long>())
.HasConversion(new CastingConverter<int, long>(), new CustomValueComparer<int>())
.HasConversion<long>()
.HasConversion<long>(new CustomValueComparer<int>())
.HasConversion<long, CustomValueComparer<int>>()
.HasMaxLength(2)
.HasPrecision(1)
.HasPrecision(1, 2)
.IsRequired()
.IsUnicode())
.IsRequired()
.IsRequired(false)
.HasAnnotation("A", "V")
.IsConcurrencyToken()
.ValueGeneratedNever()
Expand All @@ -2931,8 +2948,7 @@ public virtual void PrimitiveCollectionBuilder_methods_can_be_chained()
.HasValueGenerator<CustomValueGenerator>()
.HasValueGenerator(typeof(CustomValueGenerator))
.HasValueGeneratorFactory<CustomValueGeneratorFactory>()
.HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory))
.IsRequired();
.HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory));

[ConditionalFact]
public virtual void Can_set_primary_key_by_convention_for_user_specified_shadow_primitive_collection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1978,5 +1978,103 @@ public virtual void Shared_type_used_as_owned_type_throws_for_same_name()
() => b.OwnsMany("Shared1", e => e.Collection)).Message);
});
}

[ConditionalFact]
public virtual void PrimitiveCollectionBuilder_methods_can_be_chained()
=> CreateModelBuilder()
.Entity<ComplexProperties>()
.OwnsOne(e => e.CollectionQuarks)
.PrimitiveCollection(e => e.Up)
.ElementType(t => t
.HasAnnotation("B", "C")
.HasConversion(typeof(long))
.HasConversion(new CastingConverter<int, long>())
.HasConversion(typeof(long), typeof(CustomValueComparer<int>))
.HasConversion(typeof(long), new CustomValueComparer<int>())
.HasConversion(new CastingConverter<int, long>())
.HasConversion(new CastingConverter<int, long>(), new CustomValueComparer<int>())
.HasConversion<long>()
.HasConversion<long>(new CustomValueComparer<int>())
.HasConversion<long, CustomValueComparer<int>>()
.HasMaxLength(2)
.HasPrecision(1)
.HasPrecision(1, 2)
.IsRequired()
.IsUnicode())
.IsRequired()
.HasAnnotation("A", "V")
.IsConcurrencyToken()
.ValueGeneratedNever()
.ValueGeneratedOnAdd()
.ValueGeneratedOnAddOrUpdate()
.ValueGeneratedOnUpdate()
.IsUnicode()
.HasMaxLength(100)
.HasSentinel(null)
.HasValueGenerator<CustomValueGenerator>()
.HasValueGenerator(typeof(CustomValueGenerator))
.HasValueGeneratorFactory<CustomValueGeneratorFactory>()
.HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory))
.IsRequired();

[ConditionalFact]
public virtual void PrimitiveCollectionBuilder_methods_can_be_chained_on_collection()
=> CreateModelBuilder()
.Entity<Customer>()
.OwnsMany(e => e.Orders)
.PrimitiveCollection<List<int>>("List")
.ElementType(t => t
.HasAnnotation("B", "C")
.HasConversion(typeof(long))
.HasConversion(new CastingConverter<int, long>())
.HasConversion(typeof(long), typeof(CustomValueComparer<int>))
.HasConversion(typeof(long), new CustomValueComparer<int>())
.HasConversion(new CastingConverter<int, long>())
.HasConversion(new CastingConverter<int, long>(), new CustomValueComparer<int>())
.HasConversion<long>()
.HasConversion<long>(new CustomValueComparer<int>())
.HasConversion<long, CustomValueComparer<int>>()
.HasMaxLength(2)
.HasPrecision(1)
.HasPrecision(1, 2)
.IsRequired()
.IsUnicode())
.IsRequired()
.HasAnnotation("A", "V")
.IsConcurrencyToken()
.ValueGeneratedNever()
.ValueGeneratedOnAdd()
.ValueGeneratedOnAddOrUpdate()
.ValueGeneratedOnUpdate()
.IsUnicode()
.HasMaxLength(100)
.HasSentinel(null)
.HasValueGenerator<CustomValueGenerator>()
.HasValueGenerator(typeof(CustomValueGenerator))
.HasValueGeneratorFactory<CustomValueGeneratorFactory>()
.HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory))
.IsRequired();

private class CustomValueGenerator : ValueGenerator<int>
{
public override int Next(EntityEntry entry)
=> throw new NotImplementedException();

public override bool GeneratesTemporaryValues
=> false;
}

private class CustomValueGeneratorFactory : ValueGeneratorFactory
{
public override ValueGenerator Create(IProperty property, ITypeBase entityType)
=> new CustomValueGenerator();
}
private class CustomValueComparer<T> : ValueComparer<T>
{
public CustomValueComparer()
: base(false)
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,9 @@ public abstract TestPropertyBuilder<TProperty> HasConversion<TConverter, TCompar

public abstract class TestPrimitiveCollectionBuilder<TProperty>
{
public abstract IMutableProperty Metadata { get; }
public abstract TestElementTypeBuilder ElementType();
public abstract TestPrimitiveCollectionBuilder<TProperty> ElementType(Action<TestElementTypeBuilder> builderAction);

public abstract IMutableProperty Metadata { get; }
public abstract TestPrimitiveCollectionBuilder<TProperty> HasAnnotation(string annotation, object? value);
public abstract TestPrimitiveCollectionBuilder<TProperty> IsRequired(bool isRequired = true);
public abstract TestPrimitiveCollectionBuilder<TProperty> HasMaxLength(int maxLength);
Expand Down Expand Up @@ -652,6 +651,8 @@ public abstract TestComplexTypePropertyBuilder<TProperty> HasConversion<TConvert
public abstract class TestComplexTypePrimitiveCollectionBuilder<TProperty>
{
public abstract IMutableProperty Metadata { get; }
public abstract TestElementTypeBuilder ElementType();
public abstract TestComplexTypePrimitiveCollectionBuilder<TProperty> ElementType(Action<TestElementTypeBuilder> builderAction);
public abstract TestComplexTypePrimitiveCollectionBuilder<TProperty> HasAnnotation(string annotation, object? value);
public abstract TestComplexTypePrimitiveCollectionBuilder<TProperty> IsRequired(bool isRequired = true);
public abstract TestComplexTypePrimitiveCollectionBuilder<TProperty> HasMaxLength(int maxLength);
Expand Down Expand Up @@ -908,6 +909,11 @@ public abstract TestOwnedNavigationBuilder<TEntity, TDependentEntity> HasAnnotat
public abstract TestPropertyBuilder<TProperty> Property<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression);

public abstract TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(string propertyName);

public abstract TestPrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(
Expression<Func<TDependentEntity, TProperty>> propertyExpression);

public abstract TestNavigationBuilder Navigation<TNavigation>(
Expression<Func<TDependentEntity, TNavigation?>> navigationExpression)
where TNavigation : class;
Expand Down

0 comments on commit 9a796b8

Please sign in to comment.