net-repository-pattern

I implement repository pattern with Unit of Work:

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "net-repository-pattern" with this command: npx skills add mitkox/ai-coding-factory/mitkox-ai-coding-factory-net-repository-pattern

What I Do

I implement repository pattern with Unit of Work:

  • Generic repository base

  • Specific repositories

  • Unit of Work pattern

  • EF Core integration

  • Specification pattern support

When to Use Me

Use this skill when:

  • Implementing data access layer

  • Adding repository abstractions

  • Working with EF Core

  • Need Unit of Work pattern

Repository Structure

src/{ProjectName}.Infrastructure/Data/ ├── DbContext/ │ ├── AppDbContext.cs │ └── ApplicationDbContextFactory.cs ├── Repositories/ │ ├── Base/ │ │ ├── Repository.cs │ │ └── ReadOnlyRepository.cs │ ├── ProductRepository.cs │ ├── OrderRepository.cs │ └── UserRepository.cs ├── UnitOfWork/ │ ├── IUnitOfWork.cs │ └── UnitOfWork.cs ├── Specifications/ │ ├── ISpecification.cs │ └── SpecificationEvaluator.cs └── Migrations/

Repository Implementation

Generic Repository Interface

public interface IRepository<TEntity> where TEntity : Entity { Task<TEntity?> GetByIdAsync(Guid id); Task<IReadOnlyList<TEntity>> GetAllAsync(); Task<IReadOnlyList<TEntity>> ListAsync( ISpecification<TEntity> spec); Task<TEntity?> GetEntityWithSpec(ISpecification<TEntity> spec); Task<int> CountAsync(ISpecification<TEntity> spec); void Add(TEntity entity); void Update(TEntity entity); void Delete(TEntity entity); }

Unit of Work

public interface IUnitOfWork : IDisposable { IProductRepository Products { get; } IOrderRepository Orders { get; } IUserRepository Users { get; } Task<int> CompleteAsync(); Task RollbackAsync(); }

Specification Pattern

public interface ISpecification<T> { Expression<Func<T, bool>> Criteria { get; } List<Expression<Func<T, object>>> Includes { get; } string IncludeString { get; } Expression<Func<T, object>> OrderBy { get; } Expression<Func<T, object>> OrderByDescending { get; } }

Best Practices

  • Repositories are per aggregate root

  • Use specifications for complex queries

  • Unit of Work manages transactions

  • DbContext is internal to infrastructure

  • Repository interfaces in Domain layer

  • Implementations in Infrastructure layer

Example Usage

Create repository implementation for:

  • Product aggregate
  • Order aggregate
  • Customer aggregate With Unit of Work pattern

I will generate complete repository implementation with EF Core.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ai-image-generator

AI 图片与视频异步生成技能,调用 AI Artist API 根据文本提示词生成图片或视频,自动轮询直到任务完成。 ⚠️ 使用前必须设置环境变量 AI_ARTIST_TOKEN 为你自己的 API Key! 获取 API Key:访问 https://staging.kocgo.vip/index 注册登录后创建。 支持图片模型:SEEDREAM5_0(默认高质量图片)、NANO_BANANA_2(轻量快速)。 支持视频模型:SEEDANCE_1_5_PRO(文生视频,支持音频)、SORA2(文生视频或首尾帧图生视频,支持 firstImageUrl/lastImageUrl)。 触发场景: - 用户要求生成图片,如"生成一匹狼"、"画一只猫"、"风景画"、"帮我画"等。 - 用户要求生成视频,如"生成视频"、"用 SORA2 生成"、"文生视频"、"图生视频"、"生成一段...的视频"等。 - 用户指定模型:SEEDREAM5_0、NANO_BANANA_2、SEEDANCE_1_5_PRO、SORA2。

Archived SourceRecently Updated
General

淘宝投放数据分析

# 投放数据分析技能

Archived SourceRecently Updated
General

productclank-campaigns

Community-powered growth for builders. Boost amplifies your social posts with authentic community engagement (replies, likes, reposts). Discover finds relevant conversations and generates AI-powered replies at scale. Use Boost when the user has a post URL. Use Discover when the user wants to find and engage in conversations about their product.

Archived SourceRecently Updated
General

Made In China

# Made-in-China Trade Data Analyst

Archived SourceRecently Updated