![]() |
VOOZH | about |
dotnet add package DragonFly.BlockField.Core --version 1.0.12
NuGet\Install-Package DragonFly.BlockField.Core -Version 1.0.12
<PackageReference Include="DragonFly.BlockField.Core" Version="1.0.12" />
<PackageVersion Include="DragonFly.BlockField.Core" Version="1.0.12" />Directory.Packages.props
<PackageReference Include="DragonFly.BlockField.Core" />Project file
paket add DragonFly.BlockField.Core --version 1.0.12
#r "nuget: DragonFly.BlockField.Core, 1.0.12"
#:package DragonFly.BlockField.Core@1.0.12
#addin nuget:?package=DragonFly.BlockField.Core&version=1.0.12Install as a Cake Addin
#tool nuget:?package=DragonFly.BlockField.Core&version=1.0.12Install as a Cake Tool
| Package | Release |
|---|---|
| DragonFly.Core | ๐ NuGet |
| DragonFly.AspNetCore | ๐ NuGet |
| DragonFly.API | ๐ NuGet |
| DragonFly.Client | ๐ NuGet |
| DragonFly.BlockField | ๐ 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)]
private DateTime? _date;
[StringField(Required = true, Searchable = true, ListField = true, MinLength = 8, MaxLength = 512)]
private string? _title;
[TextField]
private string? _description;
[SlugField(Required = true, Index = true)]
private string? _slug;
[AssetField(ListField = true, ShowPreview = true)]
private AssetField _image;
[BlockField]
private BlockField _mainContent;
}
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()
.AddImageWizard()
.AddRestApi()
.AddMongoDbStorage()
.AddMongoDbIdentity()
.AddBlockField()
.AddApiKeys();
var app = builder.Build();
//init DragonFly
await app.InitDragonFlyAsync();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebAssemblyDebugging();
}
app.UseDragonFly(x => x
.MapImageWizard()
.MapApiKey()
.MapIdentity()
.MapRestApi());
app.UseDragonFlyManager();
app.UseRouting();
app.Run();
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<DragonFly.App.Client.App>("app");
//Register DragonFly components
builder.AddDragonFly()
.AddRestApi()
.AddBlockField()
.AddIdentity()
.AddApiKeys();
WebAssemblyHost host = builder.Build();
await host.InitDragonFlyAsync();
await host.RunAsync();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. 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 2 NuGet packages that depend on DragonFly.BlockField.Core:
| Package | Downloads |
|---|---|
|
DragonFly.BlockField
Headless CMS based on ASP.NET Core and Blazor |
|
|
DragonFly.BlockField.Client
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.12 | 367 | 3/7/2024 |
| 1.0.11 | 317 | 3/7/2024 |
| 1.0.10 | 310 | 3/6/2024 |
| 1.0.9 | 338 | 3/3/2024 |
| 1.0.8 | 323 | 2/22/2024 |
| 1.0.7 | 357 | 2/7/2024 |
| 1.0.6 | 368 | 1/18/2024 |
| 1.0.5 | 429 | 12/18/2023 |
| 1.0.4 | 358 | 12/2/2023 |
| 1.0.3 | 316 | 11/30/2023 |
| 1.0.2 | 318 | 11/30/2023 |
| 1.0.1 | 317 | 11/30/2023 |
| 0.9.32 | 472 | 8/25/2023 |
| 0.9.31 | 486 | 7/27/2023 |
| 0.9.30 | 469 | 7/27/2023 |
| 0.9.22 | 499 | 6/30/2023 |
| 0.9.20 | 487 | 6/27/2023 |
| 0.9.19 | 543 | 6/22/2023 |
| 0.9.17 | 537 | 5/9/2023 |
| 0.9.16 | 572 | 4/28/2023 |