![]() |
VOOZH | about |
dotnet add package DragonFly.Core --version 1.0.37
NuGet\Install-Package DragonFly.Core -Version 1.0.37
<PackageReference Include="DragonFly.Core" Version="1.0.37" />
<PackageVersion Include="DragonFly.Core" Version="1.0.37" />Directory.Packages.props
<PackageReference Include="DragonFly.Core" />Project file
paket add DragonFly.Core --version 1.0.37
#r "nuget: DragonFly.Core, 1.0.37"
#:package DragonFly.Core@1.0.37
#addin nuget:?package=DragonFly.Core&version=1.0.37Install as a Cake Addin
#tool nuget:?package=DragonFly.Core&version=1.0.37Install as a Cake Tool
| Package | Release |
|---|---|
| DragonFly.Core | ๐ NuGet |
| DragonFly.AspNetCore | ๐ NuGet |
| DragonFly.API | ๐ NuGet |
| DragonFly.Client | ๐ NuGet |
| DragonFly.Generator | ๐ NuGet |
| DragonFly.ImageWizard | ๐ NuGet |
| DragonFly.MongoDB | ๐ NuGet |
| DragonFly.Identity | ๐ NuGet |
| DragonFly.ApiKeys | ๐ NuGet |
To use the project template you need first to download and install it from NuGet.
dotnet new install DragonFly.Templates
After this you can create the project with:
dotnet new DragonFly
If you have a remote MongoDB instance, you need to add some appsettings:
"MongoDB": {
"Hostname": "localhost",
"Database": "DragonFly_App",
"Port": 27017,
"Username": "",
"Password": ""
},
IContentStorage contentStorage = ...;//use MongoStorage or ClientContentService (http client)
//create brand schema
ContentSchema schemaBrand = new ContentSchema("Brand")
.AddString("Name")
.AddSlug("Slug")
.AddTextArea("Description");
//Define schema for product
ContentSchema schemaProduct = new ContentSchema("Product")
.AddReference("Brand")
.AddString("Name", options => options.IsRequired = true)
.AddSlug("Slug")
.AddBool("IsAvailable", options => options.DefaultValue = true)
.AddFloat("Price")
.AddTextArea("Description", options => options.MaxLength = 255)
.AddArray("Attributes", options => options
.AddString("Name")
.AddString("Value"));
await contentStorage.CreateAsync(schemaProduct);
//create product by schema
ContentItem contentProduct = schemaProduct
.CreateContent()
.SetReference("Brand", new ContentItem(Guid.Parse(""), schemaBrand))
.SetString("Name", "ProductA")
.SetBool("IsAvailable", true)
.SetFloat("Price", 9.99)
.SetTextArea("Description", "...")
.AddArrayItem("Attributes", schemaProduct, item => item
.SetString("Name", "Size")
.SetString("Value", "M"));
await contentStorage.CreateAsync(contentProduct);
DragonFly.Generator
[ContentItem]
public partial class BlogPost
{
[DateField(Required = true)]
public partial DateTime? Date { get; set; }
[StringField(Required = true, Searchable = true, ListField = true, MinLength = 8, MaxLength = 512)]
public partial string? Title { get; set; }
[TextField]
public partial string? Description { get; set; }
[SlugField(Required = true, Index = true)]
public partial string? Slug { get; set; }
[AssetField(ListField = true, ShowPreview = true)]
public partial AssetField Image { get; set; }
[BlockField]
public partial BlockField MainContent { get; set; }
}
builder.Services.AddDragonFly()
.AddModels(x => x.Add<BlogPost>());
//get all items
var result = await ContentStorage.QueryAsync<BlogPostModel>(x => x
.Published(true)
.Top(10)
.Slug(x => x.Slug, "my-product")
.Integer(x => x.Quantity, 10, NumberQueryType.Equal)
.String(x => x.Title, "Test", StringQueryType.Equal)
);
For long running jobs you can use the BackgroundTaskManager.
IBackgroundTaskManager taskManager = app.Services.GetRequiredService<IBackgroundTaskManager>();
taskManager.Start("Test", async ctx => await Task.Delay(TimeSpan.FromSeconds(60), ctx.CancellationToken));
builder.Services.Configure<DragonFlyOptions>(Configuration.GetSection("General"));
builder.Services.Configure<MongoDbOptions>(Configuration.GetSection("MongoDB"));
//add DragonFly services
builder.Services.AddDragonFly(x => x
.AddImageWizard(requireAuthorization: false)
.AddRestApi()
.AddMongoDbStorage()
.AddMongoDbIdentity()
.AddApiKeys());
var app = builder.Build();
//init DragonFly
await app.InitDragonFlyAsync();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebAssemblyDebugging();
}
app.UseDragonFly();
app.UseDragonFlyManager();
app.UseRouting();
app.Run();
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<DragonFly.App.Client.App>("app");
//Register DragonFly components
builder.AddDragonFlyClient(x => x
.AddRestClient()
.AddIdentity()
.AddApiKeys());
WebAssemblyHost host = builder.Build();
await host.InitDragonFlyAsync();
await host.RunAsync();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on DragonFly.Core:
| Package | Downloads |
|---|---|
|
DragonFly.AspNetCore
Headless CMS based on ASP.NET Core and Blazor |
|
|
DragonFly.API.Core
Headless CMS based on ASP.NET Core and Blazor |
|
|
DragonFly.Client
Headless CMS based on ASP.NET Core and Blazor |
|
|
DragonFly.ApiKeys.Core
Headless CMS based on ASP.NET Core and Blazor |
|
|
DragonFly.Identity.Core
Headless CMS based on ASP.NET Core and Blazor |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.37 | 518 | 8/14/2025 |
| 1.0.35 | 432 | 6/1/2025 |
| 1.0.34 | 419 | 5/5/2025 |
| 1.0.31 | 740 | 3/24/2025 |
| 1.0.30 | 712 | 3/24/2025 |
| 1.0.29 | 715 | 3/24/2025 |
| 1.0.28 | 380 | 2/25/2025 |
| 1.0.27 | 370 | 2/5/2025 |
| 1.0.26 | 377 | 1/28/2025 |
| 1.0.25 | 395 | 1/2/2025 |
| 1.0.24 | 377 | 12/30/2024 |
| 1.0.22 | 360 | 11/19/2024 |
| 1.0.21 | 375 | 11/19/2024 |
| 1.0.20 | 365 | 11/19/2024 |
| 1.0.19 | 337 | 11/18/2024 |
| 1.0.18 | 348 | 11/17/2024 |
| 1.0.17 | 349 | 11/17/2024 |
| 1.0.15 | 466 | 4/27/2024 |
| 1.0.14 | 512 | 3/19/2024 |
| 1.0.13 | 326 | 3/19/2024 |