Skip to content

Commit 55e4690

Browse files
committed
Merge branch 'master' of github.com:Calabonga/UnitOfWork
2 parents 0c3ec05 + a187f08 commit 55e4690

File tree

4 files changed

+55
-18
lines changed

4 files changed

+55
-18
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
## Версии
1010

11+
### 6.1.0 2025-10-13
12+
13+
* `FromSqlRawInterpolated` implemented in `IUnitOfWork` from `DbContext`.
14+
* * New release `6.1.0` published on the nuget.org.
15+
1116
### 6.0.0 2025-03-05
1217

1318
* Deprecated methods were removed. Please use `TrackingType` parameter instead of `disableTracking`.
@@ -53,7 +58,7 @@
5358
return [];
5459
}
5560
```
56-
Достаточно явно добавить тип ``
61+
Достаточно явно добавить тип
5762
``` csharp
5863
public async Task<IEnumerable<PictureFile>> GetFilesForPostAsync(Guid postId, CancellationToken cancellationToken)
5964
{

src/Calabonga.UnitOfWork/Calabonga.UnitOfWork.csproj

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
5-
<Version>6.0.0</Version>
5+
<Version>6.1.0</Version>
66
<Authors>Calabonga</Authors>
77
<Company>Calabonga SOFT</Company>
8-
<Copyright>Calabonga SOFT © 2001-$([System.DateTime]::Now.ToString(yyyy))</Copyright>
8+
<Copyright>Calabonga SOFT © 2001-$([System.DateTime]::Now.ToString(yyyy))</Copyright>
99
<Description>Unit of Work implementation for EntityFramework Core. For more information please see Calabonga.UnitOfWork package.</Description>
1010
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1111
<PackageIcon>logo.png</PackageIcon>
1212
<PackageTags>Calabonga EntityFrameworkCore UnitOfWork Repository Extension Helper unitofowrk ORM pagination pattern changes Tracking entites</PackageTags>
13-
<PackageReleaseNotes>Obsolete methods were removed. Please use TrackingType parameter for DbContext operations: NoTraking, Tracking and NoTrackingWithIdentityResolution.</PackageReleaseNotes>
13+
<PackageReleaseNotes>FromSqlRawInterpolated implemented in IUnitOfWork from DbContext.</PackageReleaseNotes>
1414
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1515
<PackageProjectUrl>https://www.calabonga.net</PackageProjectUrl>
1616
<Nullable>enable</Nullable>
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
1818
<RepositoryUrl>https://github.com/Calabonga/UnitOfWork</RepositoryUrl>
1919
<RepositoryType>git</RepositoryType>
20-
<IncludeSymbols>true</IncludeSymbols>
21-
<IncludeSource>true</IncludeSource>
22-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
23-
<Deterministic>true</Deterministic>
20+
<IncludeSymbols>true</IncludeSymbols>
21+
<IncludeSource>true</IncludeSource>
22+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
23+
<Deterministic>true</Deterministic>
2424
</PropertyGroup>
2525

2626
<ItemGroup>
@@ -33,15 +33,15 @@
3333
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" Condition="'$(TargetFramework)' == 'net9.0'" />
3434
</ItemGroup>
3535

36-
<ItemGroup>
37-
<None Include="..\..\README.md">
38-
<Pack>True</Pack>
39-
<PackagePath>\</PackagePath>
40-
</None>
41-
<None Include="logo.png">
42-
<Pack>True</Pack>
43-
<PackagePath>\</PackagePath>
44-
</None>
45-
</ItemGroup>
36+
<ItemGroup>
37+
<None Include="..\..\README.md">
38+
<Pack>True</Pack>
39+
<PackagePath>\</PackagePath>
40+
</None>
41+
<None Include="logo.png">
42+
<Pack>True</Pack>
43+
<PackagePath>\</PackagePath>
44+
</None>
45+
</ItemGroup>
4646

4747
</Project>

src/Calabonga.UnitOfWork/IUnitOfWork.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ public interface IUnitOfWork : IDisposable
7878
/// <returns>An <see cref="IQueryable{T}"/> that contains elements that satisfy the condition specified by raw SQL.</returns>
7979
IQueryable<TEntity> FromSqlRaw<TEntity>(string sql, params object[] parameters) where TEntity : class;
8080

81+
/// <summary>
82+
/// Uses interpolated raw SQL queries to fetch the specified <typeparamref name="TEntity"/> data.
83+
/// </summary>
84+
/// <typeparam name="TEntity"></typeparam>
85+
/// <param name="sql"></param>
86+
/// <returns></returns>
87+
IQueryable<TEntity> FromSqlRawInterpolated<TEntity>(FormattableString sql) where TEntity : class;
88+
89+
/// <summary>
90+
/// Uses SQL queries to fetch the specified <typeparamref name="TEntity"/> data.
91+
/// </summary>
92+
/// <typeparam name="TEntity"></typeparam>
93+
/// <param name="sql"></param>
94+
/// <returns></returns>
95+
IQueryable<TEntity> FromSql<TEntity>(FormattableString sql) where TEntity : class;
96+
8197
/// <summary>
8298
/// Uses Track Graph Api to attach disconnected entities
8399
/// </summary>

src/Calabonga.UnitOfWork/UnitOfWork.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ public IRepository<TEntity> GetRepository<TEntity>(bool hasCustomRepository = fa
141141
/// <returns>An <see cref="IQueryable{T}" /> that contains elements that satisfy the condition specified by raw SQL.</returns>
142142
public IQueryable<TEntity> FromSqlRaw<TEntity>(string sql, params object[] parameters) where TEntity : class => DbContext.Set<TEntity>().FromSqlRaw(sql, parameters);
143143

144+
/// <summary>
145+
/// Uses interpolated raw SQL queries to fetch the specified <typeparamref name="TEntity"/> data.
146+
/// </summary>
147+
/// <typeparam name="TEntity"></typeparam>
148+
/// <param name="sql"></param>
149+
/// <returns></returns>
150+
public IQueryable<TEntity> FromSqlRawInterpolated<TEntity>(FormattableString sql) where TEntity : class => DbContext.Set<TEntity>().FromSqlInterpolated(sql);
151+
152+
/// <summary>
153+
/// Uses SQL queries to fetch the specified <typeparamref name="TEntity"/> data.
154+
/// </summary>
155+
/// <typeparam name="TEntity"></typeparam>
156+
/// <param name="sql"></param>
157+
/// <returns></returns>
158+
public IQueryable<TEntity> FromSql<TEntity>(FormattableString sql) where TEntity : class => DbContext.Set<TEntity>().FromSql(sql);
159+
144160
/// <summary>
145161
/// Saves all changes made in this context to the database.
146162
/// </summary>

0 commit comments

Comments
 (0)