{"id":43208911,"url":"https://github.com/goodtocode/aspect-domain","last_synced_at":"2026-02-01T07:13:06.692Z","repository":{"id":333623864,"uuid":"1137948479","full_name":"goodtocode/aspect-domain","owner":"goodtocode","description":"Foundational types for building DDD, clean architecture, and event-driven systems. It includes base classes for domain entities, audit fields, domain events, and secured/multi-tenant entities.","archived":false,"fork":false,"pushed_at":"2026-01-20T08:02:57.000Z","size":44,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T14:37:15.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goodtocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-20T03:47:43.000Z","updated_at":"2026-01-20T06:55:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/goodtocode/aspect-domain","commit_stats":null,"previous_names":["goodtocode/aspect-domain"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/goodtocode/aspect-domain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-domain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-domain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-domain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-domain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goodtocode","download_url":"https://codeload.github.com/goodtocode/aspect-domain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-domain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28971713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T06:46:42.625Z","status":"ssl_error","status_checked_at":"2026-02-01T06:44:56.173Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-01T07:13:05.711Z","updated_at":"2026-02-01T07:13:06.681Z","avatar_url":"https://github.com/goodtocode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# Goodtocode.Domain\n\nDomain-Driven Design (DDD) base library for .NET Standard 2.0+ and .NET\n\n[![NuGet CI/CD](https://github.com/goodtocode/aspect-domain/actions/workflows/gtc-domain-nuget.yml/badge.svg)](https://github.com/goodtocode/aspect-domain/actions/workflows/gtc-domain-nuget.yml)\n\nGoodtocode.Domain provides foundational types for building DDD, clean architecture, and event-driven systems. It includes base classes for domain entities, audit fields, domain events, and secured/multi-tenant entities. The library is designed for extensibility and can be integrated into any .NET Standard 2.0+ or .NET project.\n\n## Features\n- Domain entity base with audit fields (`CreatedOn`, `ModifiedOn`, `DeletedOn`, `Timestamp`)\n- Domain event pattern for eventual consistency and cross-context communication\n- Equality and identity management for aggregate roots\n- Secured entity base for multi-tenancy and ownership (`OwnerId`, `TenantId`)\n- Extension methods for authorization and ownership queries\n- Lightweight, dependency-free, and compatible with .NET Standard 2.0+ and .NET\n- Designed for use with EF Core, CosmosDb, custom repositories, and APIs\n\n## Quick-Start Steps\n1. Clone this repository\n   ```\n   git clone https://github.com/goodtocode/aspect-domain.git\n   ```\n2. Install .NET SDK (latest recommended)\n   ```\n   winget install Microsoft.DotNet.SDK --silent\n   ```\n3. Build the solution\n   ```\n   cd src\n   dotnet build Goodtocode.Domain.sln\n   ```\n4. Run tests\n   ```\n   cd Goodtocode.Domain.Tests\n   dotnet test\n   ```\n\n## Install Prerequisites\n- [.NET SDK (latest)](https://dotnet.microsoft.com/en-us/download)\n- Visual Studio (latest) or VS Code\n\n## Top Use Case Examples\n\n### 1. Basic Domain Entity with Audit Fields\n```csharp\nusing Goodtocode.Domain.DomainEntity;\n\npublic class MyEntity : DomainEntity\u003cMyEntity\u003e\n{\n    public string Name { get; private set; } = string.Empty;\n    public int Value { get; private set; }\n\n    public static MyEntity Create(Guid id, string name, int value)\n    {\n        return new MyEntity\n        {\n            Id = id == Guid.Empty ? Guid.NewGuid() : id,\n            Name = name,\n            Value = value,\n            CreatedOn = DateTime.UtcNow\n        };\n    }\n}\n```\n\n### 2. Secured Entity for Multi-Tenant and Ownership Scenarios\n```csharp\nusing Goodtocode.Domain.SecuredEntity;\n\npublic class DigitalAgentEntity : SecuredEntity\u003cDigitalAgentEntity\u003e\n{\n    protected DigitalAgentEntity() { }\n\n    public Guid DigitalAssetId { get; private set; }\n    public string? Name { get; private set; } = string.Empty;\n    public string? Description { get; private set; } = string.Empty;\n    public AgentStatus Status { get; private set; } = AgentStatus.Inactive;\n    public ICollection\u003cstring\u003e Tags { get; private set; } = [];\n    public virtual Guid AgentPersonaId { get; private set; } = Personas.Monitor.Id;\n\n    public static DigitalAgentEntity Create(Guid id, Guid digitalAssetId, Guid agentPersonaId, Guid tenantId, Guid ownerId, AgentStatus status, string? name = null, string? description = null)\n    {\n        return new DigitalAgentEntity()\n        {\n            Id = id == Guid.Empty ? Guid.NewGuid() : id,\n            DigitalAssetId = digitalAssetId,\n            AgentPersonaId = agentPersonaId,\n            Status = status,\n            Name = name,\n            Description = description,\n            TenantId = tenantId,\n            OwnerId = ownerId\n        };\n    }\n\n    public void Activate() =\u003e Status = AgentStatus.Active;\n    public void Deactivate() =\u003e Status = AgentStatus.Inactive;\n    public void Update(string? name, string? description)\n    {\n        Name = name;\n        Description = description;\n    }\n}\n```\n\n### 3. Domain Events for Eventual Consistency\n```csharp\nusing Goodtocode.Domain.DomainEvent;\n\npublic class MyCreatedEvent : IDomainEvent\u003cMyEntity\u003e\n{\n    public MyEntity Entity { get; }\n    public MyCreatedEvent(MyEntity entity) =\u003e Entity = entity;\n}\n\n// Usage in entity\nvar entity = MyEntity.Create(Guid.NewGuid(), \"Test\", 42);\nentity.AddDomainEvent(new MyCreatedEvent(entity));\n```\n\n### 4. Secured Entity Authorization Extensions\n```csharp\nusing Goodtocode.Domain.SecuredEntity;\n\n// Query for entities owned by a user\nvar ownedAgents = dbContext.Agents.IsOwner(userId);\n\n// Query for entities authorized for a tenant or owner\nvar authorizedAgents = dbContext.Agents.WhereAuthorized(tenantId, userId);\n```\n\n## Technologies\n- [C# .NET](https://docs.microsoft.com/en-us/dotnet/csharp/)\n- [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/)\n\n## Version History\n\n| Version | Date        | Release Notes                                    |\n|---------|-------------|--------------------------------------------------|\n | 1.1.0   | 2026-Jan-20 | Version bump, CI/CD improvements, props and targets updates |\n | 1.0.0   | 2026-Jan-19 | Initial release                                  |\n\n## License\n\nThis project is licensed with the [MIT license](https://mit-license.org/).\n\n## Contact\n- [GitHub Repo](https://github.com/goodtocode/aspect-domain)\n- [@goodtocode](https://twitter.com/goodtocode)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodtocode%2Faspect-domain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodtocode%2Faspect-domain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodtocode%2Faspect-domain/lists"}