ShipAsync.D365.InfrastructureGenerator
1.0.60
dotnet add package ShipAsync.D365.InfrastructureGenerator --version 1.0.60
NuGet\Install-Package ShipAsync.D365.InfrastructureGenerator -Version 1.0.60
<PackageReference Include="ShipAsync.D365.InfrastructureGenerator" Version="1.0.60" />
<PackageVersion Include="ShipAsync.D365.InfrastructureGenerator" Version="1.0.60" />
<PackageReference Include="ShipAsync.D365.InfrastructureGenerator" />
paket add ShipAsync.D365.InfrastructureGenerator --version 1.0.60
#r "nuget: ShipAsync.D365.InfrastructureGenerator, 1.0.60"
#:package ShipAsync.D365.InfrastructureGenerator@1.0.60
#addin nuget:?package=ShipAsync.D365.InfrastructureGenerator&version=1.0.60
#tool nuget:?package=ShipAsync.D365.InfrastructureGenerator&version=1.0.60
D365 Infrastructure Generator
A C# source generator for declaratively defining Dynamics 365 entities and fields using attributes.
Features
- Declarative Infrastructure: Define D365 entities and fields using C# attributes
- Source Generation: Automatically generates infrastructure creation code at compile time
- Type Safety: Compile-time validation of entity and field configurations
- Easy to Use: Simple attribute-based API
- Full Field Support: Support for all D365 field types (text, number, currency, date, boolean, choice, lookup, etc.)
Installation
Option 1: Install the complete package (Recommended)
dotnet add package ShipAsync.D365.InfrastructureGenerator
This single package includes everything: attributes, source generator, and runtime.
Option 2: Install individual packages
If you need more control, install the packages separately:
dotnet add package ShipAsync.D365.Attributes
dotnet add package ShipAsync.D365.SourceGenerator
dotnet add package ShipAsync.D365.Runtime
Quick Start
1. Define Your Entity
using D365.Attributes.Entity;
using D365.Attributes.Fields;
using D365.Attributes.Common;
namespace MyApp.Entities;
[D365Entity("new_product", "Product", "Products",
Description = "Product catalog entity",
PrimaryFieldSchemaName = "new_name",
PrimaryFieldDisplayName = "Product Name",
OwnershipType = OwnershipType.UserOwned,
HasActivities = true,
Mode = OperationMode.Upsert)]
public partial class Product
{
[TextField(
SchemaName = "new_name",
DisplayName = "Product Name",
MaxLength = 100,
RequiredLevel = RequiredLevel.ApplicationRequired,
Order = 1)]
public string? Name { get; set; }
[CurrencyField(
SchemaName = "new_unitprice",
DisplayName = "Unit Price",
Precision = 2,
RequiredLevel = RequiredLevel.ApplicationRequired,
Order = 2)]
public decimal UnitPrice { get; set; }
[BooleanField(
SchemaName = "new_isactive",
DisplayName = "Is Active",
TrueLabel = "Active",
FalseLabel = "Inactive",
DefaultValue = true,
Order = 3)]
public bool IsActive { get; set; }
}
2. Generate Infrastructure
The source generator automatically creates a GenerateInfrastructure() method:
using D365.Runtime;
// Create a DynamicsTableCreator instance
var creator = new DynamicsTableCreator(
baseUrl: "https://yourorg.crm.dynamics.com",
accessToken: "your-access-token"
);
// Generate the infrastructure
var result = await Product.GenerateInfrastructure(creator);
if (result.IsSuccess)
{
Console.WriteLine($"Entity created: {result.EntityCreated}");
Console.WriteLine($"Fields created: {result.FieldsCreated}");
}
else
{
foreach (var error in result.Errors)
{
Console.WriteLine($"Error: {error}");
}
}
Supported Field Types
- Text: Single-line text, email, phone, URL
- MultiLineText: Multi-line text fields
- Number: Whole number fields
- Decimal: Decimal number fields
- Currency: Currency fields
- DateTime: Date and time fields
- DateOnly: Date-only fields
- Boolean: Two-option (Yes/No) fields
- LocalChoice: Local option sets
- GlobalChoice: Global option sets
- Lookup: Relationship fields
- File: File fields
- Image: Image fields
Configuration Options
Entity Attributes
SchemaName: The logical name of the entity (e.g., "new_product")DisplayName: The display name shown in UIDisplayCollectionName: The plural display nameDescription: Entity descriptionPrimaryFieldSchemaName: Schema name for the primary fieldOwnershipType: UserOwned, TeamOwned, or OrganizationOwnedHasActivities: Enable activities (emails, tasks, appointments)HasNotes: Enable notes and attachmentsMode: Create, Update, or Upsert
Field Attributes
Common properties for all field types:
SchemaName: The logical name of the fieldDisplayName: The display name shown in UIDescription: Field descriptionRequiredLevel: None, Recommended, ApplicationRequired, or SystemRequiredOrder: Display order in the generated codeMode: Create, Update, or Upsert
Requirements
- .NET 8.0 or later
- C# 10.0 or later
- Valid Dynamics 365 instance and access token
License
MIT License
Support
For issues and questions, please visit the GitHub repository.
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- ShipAsync.D365.Attributes (>= 1.0.60)
- ShipAsync.D365.Runtime (>= 1.0.60)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.60 | 259 | 10/17/2025 |