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

File scoped and explicit enums #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@
***

## Give a Star 🌟

If you liked the project or if **EasyRepository.EFCore** helped you, please give a star.

***

### Purpose

**Easy Repository For EF Core** provides implementation generic repository pattern on Entity Framework Core

***

## What is Generic Repository Pattern

The generic repository pattern implements in a separate class library project. ... The repository pattern is intended to create an Abstraction layer between the Data Access layer and Business Logic layer of an Application. It is a data access pattern that prompts a more loosely coupled approach to data access.
The generic repository pattern implements in a separate class library project. ... The repository pattern is intended to
create an Abstraction layer between the Data Access layer and Business Logic layer of an Application. It is a data
access pattern that prompts a more loosely coupled approach to data access.

***

### Documentation

Visit [Wiki](https://github.com/furkandeveloper/EasyRepository.EFCore/wiki) page for documentation.

## Star History
Expand Down
38 changes: 19 additions & 19 deletions common.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project>
<PropertyGroup>
<Title>Generic Repository Pattern For Entity Framework Core</Title>
<RepositoryType>Git</RepositoryType>
<NeutralLanguage>en-US</NeutralLanguage>
<TargetFrameworks>net6.0</TargetFrameworks>
<Version>2.0.0</Version>
<LangVersion>latest</LangVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/furkandeveloper/EasyRepository.EFCore</RepositoryUrl>
<Authors>furkandeveloper</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<Description></Description>
<PackageTags>dotnet, efcore, repository-pattern, generic-repository, generic-repository-pattern</PackageTags>
<PackageReleaseNotes>
</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<PropertyGroup>
<Title>Generic Repository Pattern For Entity Framework Core</Title>
<RepositoryType>Git</RepositoryType>
<NeutralLanguage>en-US</NeutralLanguage>
<TargetFrameworks>net6.0</TargetFrameworks>
<Version>2.0.1</Version>
<LangVersion>latest</LangVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/furkandeveloper/EasyRepository.EFCore</RepositoryUrl>
<Authors>furkandeveloper</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<Description></Description>
<PackageTags>dotnet, efcore, repository-pattern, generic-repository, generic-repository-pattern</PackageTags>
<PackageReleaseNotes>
Added Enum.AsNoTracking overloads for all methods which use asNoTracking (boolean)
</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
</Project>
87 changes: 42 additions & 45 deletions sample/EasyRepository.Sample/Context/SampleDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,62 +1,59 @@
using EasyRepository.Sample.Entities;
namespace EasyRepository.Sample.Context;

using Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace EasyRepository.Sample.Context
/// <summary>
/// Sample Database Context
/// </summary>
public class SampleDbContext : DbContext
{
/// <summary>
/// Sample Database Context
/// Ctor
/// </summary>
public class SampleDbContext : DbContext
/// <param name="options">
/// The options to be used by a Microsoft.EntityFrameworkCore.DbContext. You normally
/// override
/// Microsoft.EntityFrameworkCore.DbContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)
/// or use a Microsoft.EntityFrameworkCore.DbContextOptionsBuilder to create instances
/// of this class and it is not designed to be directly constructed in your application
/// code.
/// </param>
public SampleDbContext(DbContextOptions options)
: base(options)
{
}

protected SampleDbContext()
{
/// <summary>
/// Ctor
/// </summary>
/// <param name="options">
/// The options to be used by a Microsoft.EntityFrameworkCore.DbContext. You normally
/// override Microsoft.EntityFrameworkCore.DbContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)
/// or use a Microsoft.EntityFrameworkCore.DbContextOptionsBuilder to create instances
/// of this class and it is not designed to be directly constructed in your application
/// code.
/// </param>
public SampleDbContext(DbContextOptions options) : base(options)
{
}

protected SampleDbContext()
{
}

public virtual DbSet<Author> Authors { get; set;}

public virtual DbSet<Book> Books { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Author>(entity =>
}

public virtual DbSet<Author> Authors { get; set; }

public virtual DbSet<Book> Books { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Author>(
entity =>
{
entity
.HasMany(m => m.Books)
entity.HasMany(m => m.Books)
.WithOne(o => o.Author)
.HasForeignKey(fk => fk.AuthorId);
});

modelBuilder.Entity<Book>(entity =>
modelBuilder.Entity<Book>(
entity =>
{
entity
.HasOne(o => o.Author)
entity.HasOne(o => o.Author)
.WithMany(m => m.Books)
.HasForeignKey(fk => fk.AuthorId);
});
}
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
}
}
}
Loading