Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test scenarios have been improved #27

Merged
merged 7 commits into from
Sep 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public interface IWriteRepository
/// <param name="entity">The entity to insert.</param>
void Insert<T>(T entity) where T : class;

void AddRange<T>(IEnumerable<T> entities) where T : class;

void Add<T>(T entity) where T : class;

/// <summary>
/// Inserts a range of entities into the repository.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ public void Insert<T>(T entity) where T : class
DbContext.Set<T>().Add((T)_funcCreatedAt(entity));
}

public void Add<T>(T entity) where T : class
{
ArgumentNullException.ThrowIfNull(entity, nameof(entity));

DbContext.Set<T>().Add((T)_funcCreatedAt(entity));
}

/// <summary>
/// Inserts a range of entities into the DbContext.
/// </summary>
Expand All @@ -202,6 +209,13 @@ public void Insert<T>(params T[] entities) where T : class
DbContext.Set<T>().AddRange(entities.Select(f => (T)_funcCreatedAt(f)));
}

public void AddRange<T>(IEnumerable<T> entities) where T : class
{
ArgumentNullException.ThrowIfNull(entities, nameof(entities));

DbContext.Set<T>().AddRange(entities.Select(f => (T)_funcCreatedAt(f)));
}

/// <summary>
/// Inserts a range of entities into the DbContext.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,33 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="(6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="(6.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="(6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="(6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="(6.0.0,)">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="[6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="[6.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="[6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[6.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="[6.0.0,)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="(7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="(7.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="(7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="(7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="(7.0.0,)">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="[7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="[7.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="[7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[7.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="[7.0.0,)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="(8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="(8.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="(8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="(8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="(8.0.0,)">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="[8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="[8.0.0,)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="[8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[8.0.0,)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="[8.0.0,)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading