Skip to content

Getting Started

.ORG Projects edited this page May 19, 2026 · 2 revisions

Getting Started

Prerequisites

  • .NET 8.0 or later
  • Entity Framework Core 8.0 or later

Installation

dotnet add package DotOrgProjects.EntityPlatform.Finder

Setup

1. Register the context

In your application startup, register DbFoundContext using AddDbContext and configure EP Finder with UseFinderIn():

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using DotOrgProjects.EntityPlatform.Finder;

ServiceCollection services = new ServiceCollection();

services.AddDbContext<DbFoundContext>(options => {
    options.UseSqlServer("Server=localhost;Database=MyDb;");
    options.UseFinderIn("MyApp.Assembly", "MyApp.Entities.Root.Namespace");
});

UseFinderIn() Parameters

Parameter Description
assemblyName The name of the assembly where your entities are defined. Typically matches your project's assembly name.
rootNamespace The root namespace EP Finder will scan looking for classes annotated with [Table]. Only classes within this namespace and its sub-namespaces are discovered.

2. Annotate your entities

EP Finder only discovers classes annotated with [Table]:

using System.ComponentModel.DataAnnotations.Schema;

[Table("Products")]
public class Product {
    public int Id { get; set; }
    public string Name { get; set; }
}

3. Use the context

ServiceProvider provider = services.BuildServiceProvider();

DbFoundContext context = provider.GetRequiredService<DbFoundContext>();

List<Product> products = context.Set<Product>().ToList();

Next Steps

Clone this wiki locally