Domain.Net
5.3.0
dotnet add package Domain.Net --version 5.3.0
NuGet\Install-Package Domain.Net -Version 5.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Domain.Net" Version="5.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Domain.Net" Version="5.3.0" />
<PackageReference Include="Domain.Net" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Domain.Net --version 5.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Domain.Net, 5.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Domain.Net@5.3.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Domain.Net&version=5.3.0
#tool nuget:?package=Domain.Net&version=5.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ClassicDomain C# Driver
You can get the latest stable release from the official Nuget.org feed.
Getting Started
MongoDB Sample
You need to download MongoDB.
web.config or app.config
<connectionStrings>
<add name="Sample.Repositories.Mapping" connectionString="mongodb://localhost/Sample?journal=true" />
</connectionStrings>
Domain
namespace Sample.Domain
{
public class Person
{
public Guid Id { get; private set; }
public string FirstName { get; private set; }
public string LastName { get; private set; }
private Person() { }
public static Person Create(string firstName, string lastName)
{
var result = new Person();
result.FirstName = firstName;
result.LastName = lastName;
return result;
}
public void Change(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
}
Repositories
using Oldmansoft.ClassicDomain;
namespace Sample.Repositories
{
class Mapping : Oldmansoft.ClassicDomain.Driver.Mongo.Context
{
protected override void OnModelCreating()
{
Add<Domain.Person, Guid>(o => o.Id)
.SetUnique(g => g.CreateGroup(o => o.LastName).Add(o => o.FirstName));
}
}
}
namespace Sample.Infrastructure
{
public interface IPersonRepository : Oldmansoft.ClassicDomain.IRepository<Domain.Person, Guid>
{
Oldmansoft.ClassicDomain.IPagingData<Domain.Person> PageByName();
Domain.Person GetByName(string firstName, string lastName);
}
}
namespace Sample.Repositories
{
class PersonRepository : Oldmansoft.ClassicDomain.Driver.Mongo.Repository<Domain.Person, Guid, Mapping>, Infrastructure.IPersonRepository
{
public PersonRepository(UnitOfWork uow)
: base(uow)
{ }
public Oldmansoft.ClassicDomain.IPagingData<Domain.Person> PageByName()
{
return Query().Paging().OrderBy(o => o.LastName).ThenBy(o => o.FirstName);
}
public Domain.Person GetByName(string firstName, string lastName)
{
return Query().FirstOrDefault(o => o.LastName == lastName && o.FirstName == firstName);
}
}
}
using Oldmansoft.ClassicDomain;
namespace Sample.Repositories
{
public class RepositoryFactory
{
private UnitOfWork Uow { get; set; }
public RepositoryFactory()
{
Uow = new UnitOfWork();
}
public IUnitOfWork GetUnitOfWork()
{
return Uow;
}
public Infrastructure.IPersonRepository CreatePerson()
{
return new PersonRepository(Uow);
}
}
}
Add Domain To Repository
using Oldmansoft.ClassicDomain;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
var factory = new Repositories.RepositoryFactory();
var repository = factory.CreatePerson();
var domain = Domain.Person.Create("firstName", "lastName");
repository.Add(domain);
factory.GetUnitOfWork().Commit();
}
}
}
Replace Domain From Repository
using Oldmansoft.ClassicDomain;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
var factory = new Repositories.RepositoryFactory();
var repository = factory.CreatePerson();
var domain = repository.GetByName("firstName", "lastName");
domain.Change("first", "last");
repository.Replace(domain);
factory.GetUnitOfWork().Commit();
}
}
}
Remove Domain From Repository
using Oldmansoft.ClassicDomain;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
var factory = new Repositories.RepositoryFactory();
var repository = factory.CreatePerson();
var domain = repository.GetByName("firstName", "lastName");
repository.Remove(domain);
factory.GetUnitOfWork().Commit();
}
}
}
Maintainers:
If you have contributed and we have neglected to add you to this list please contact one of the maintainers to be added to the list (with apologies).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- System.Reflection.Emit (>= 4.7.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Domain.Net:
| Package | Downloads |
|---|---|
|
Oldmansoft.ClassicDomain.Driver.Mongo
经典领域驱动设计支持库 Mongo 驱动 |
|
|
Oldmansoft.ClassicDomain.Driver.Redis
经典领域驱动设计支持库 Redis 驱动 |
|
|
Oldmansoft.ClassicDomain.Driver.EF
经典领域驱动设计支持库 Entity Framework 驱动 |
|
|
Oldmansoft.Identity
身份权限组件 |
GitHub repositories
This package is not used by any popular GitHub repositories.