manojlds /
cmd
C# library to run external programs in a simpler way. Demonstration of "dynamic" features of C#.
68/100 healthLoading repository data…
SKahasun / repository
A demonstration of the Repository Pattern combined with the Factory Pattern in C#. This project showcases how to implement a generic repository with factory-based instantiation for managing entities in a clean, maintainable, and scalable way.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A demonstration of the Repository Pattern combined with the Factory Pattern in C#. This project showcases how to implement a generic repository with factory-based instantiation for managing entities in a clean, maintainable, and scalable way.
This project demonstrates a clean architecture approach to data management using two fundamental design patterns:
The implementation uses generic types to create a flexible, reusable data access layer that works with any entity type.
The Repository Pattern mediates between the domain and data mapping layers, acting like an in-memory collection of domain objects. Benefits include:
The Factory Pattern provides an interface for creating repository instances without specifying their concrete classes. Benefits include:
Repository-Factory-Pattern/
│
├── Models/
│ ├── BaseEntity.cs # Abstract base class for all entities
│ ├── Department.cs # Department entity
│ └── Student.cs # Student entity
│
├── Repositories/
│ ├── IRepo.cs # Generic repository interface
│ └── GenericRepo.cs # Generic repository implementation
│
├── Factories/
│ ├── IRepoFactory.cs # Factory interface
│ └── RepoFactory.cs # Factory implementation
│
├── DITest/
│ └── TastClass.cs # Test/demonstration class
│
└── Program.cs # Application entry point
BaseEntityIList<T> for data storage (easily replaceable with database context)git clone https://github.com/SKahasun/Repository_Factory_Pattern
cd Repository_Factory_Pattern
dotnet build
dotnet run
// Initialize the factory
IRepoFactory factory = new RepoFactory();
// Create a repository for Department
IRepo<Department> deptRepo = factory.CreateRepo<Department>();
// Create a repository for Student
IRepo<Student> studentRepo = factory.CreateRepo<Student>();
// CREATE - Add single entity
var dept = new Department { Id = 1, name = "Computer Science" };
deptRepo.Add(dept);
// CREATE - Add multiple entities
deptRepo.AddRange(new Department[] {
new Department { Id = 2, name = "Mathematics" },
new Department { Id = 3, name = "Physics" }
});
// READ - Get all entities
var allDepartments = deptRepo.GetAll();
// READ - Get single entity by ID
var department = deptRepo.Get(1);
// UPDATE - Modify existing entity
department.name = "Computer Engineering";
deptRepo.Update(department);
// DELETE - Remove entity by ID
deptRepo.Delete(3);
All entities inherit from BaseEntity, which provides a common Id property:
public abstract class BaseEntity
{
public int Id { get; set; }
}
public interface IRepo<T> where T : BaseEntity
{
List<T> GetAll();
T Get(int id);
void Add(T entity);
void AddRange(IEnumerable<T> entities);
void Update(T entity);
void Delete(int id);
}
The factory encapsulates the creation of repository instances:
public interface IRepoFactory
{
IRepo<T> CreateRepo<T>() where T : BaseEntity;
}
By studying this project, you will learn:
This project can be extended in several ways:
Sheikh Ahasunul Islam
⭐ If you found this project helpful, please consider giving it a star!
Selected from shared topics, language and repository description—not editorial ratings.
manojlds /
C# library to run external programs in a simpler way. Demonstration of "dynamic" features of C#.
68/100 healthmatthewrdev /
A demonstration of Neural Networks and Genetic Algorithms using C++.
37/100 healthLaurieWired /
Demonstration of syntax parsing ambiguities in C++
74/100 healthnasa /
libSPRITE is a set of libraries that have been used on several past projects including flight, technology demonstration, and simulation projects. libSPRITE provides a diverse set of functions to attempt to simplify coding and reduce code errors. For example, libSPRITE defines engineering units as types (i.e., Meters or Radians instead of double or int). It includes an engineering unit aware math library. libSPRITE includes a task scheduling system that abstracts pthreads and includes a publish subscribe data system for data routing. In addition, libSPRITE includes an optional binding to the Lua scripting language for configuring the program, setting parameters, running Lua scripts within C++ tasks and even interacting with the application during runtime.
44/100 healthrdeits /
A demonstration of a SWIG wrapper for a C++ library containing Eigen matrix types for use with Python and NumPy
54/100 healthwm4n /
A simple demonstration of using c++ library for Unity plugins
56/100 health