### Start Angular App Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/README.md Navigate to the Angular directory, install dependencies, and start the Angular development server. ```bash cd angular npm install npm start ``` -------------------------------- ### Start API Host Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/README.md Run the API host project to start the backend services. ```bash dotnet run --project src/MovieCollectionApp.HttpApi.Host ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/angular/README.md Run this command in the project root to install all necessary npm packages. ```bash npm install ``` -------------------------------- ### Install Client-Side Libraries Source: https://github.com/abpframework/abp-samples/blob/master/AIChat/README.md Install all NPM packages for MVC/Razor Pages and Blazor Server UIs. This command is typically run by the ABP CLI but can be executed manually if needed. ```bash abp install-libs ``` -------------------------------- ### Navigate and Setup Symlinks Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/angular/scripts/README.md Basic usage for setting up and removing symlinks. Ensure you are in the correct directory before running. ```powershell # Navigate to the scripts directory cd ModularCRM/angular/scripts # Setup symlinks (run this first) ./setup-symlinks.ps1 # Remove symlinks when done ./remove-symlinks.ps1 ``` -------------------------------- ### Run RabbitMQ Docker Compose Source: https://github.com/abpframework/abp-samples/blob/master/DynamicDistributedEvents/README.md Starts the RabbitMQ message broker using Docker Compose. Ensure Docker is installed and running. ```bash docker compose up -d rabbitmq ``` -------------------------------- ### Start Angular Development Server Source: https://github.com/abpframework/abp-samples/blob/master/AcmeBookStoreAngularMaterial/angular/README.md Run this command to start the development server. The application will automatically reload upon detecting source file changes. ```bash ng serve ``` -------------------------------- ### Run Symlink Setup and Cleanup Scripts Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/angular/scripts/README.md Navigate to the scripts directory and execute `setup-symlinks.ps1` to create symlinks, and `remove-symlinks.ps1` to clean them up. ```powershell # Navigate to the scripts directory cd GymWorkoutPlanner/angular/scripts # Setup symlinks (run this first) ./setup-symlinks.ps1 # Remove symlinks when done ./remove-symlinks.ps1 ``` -------------------------------- ### Navigate and Setup Symlinks Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/angular/scripts/README.md Basic usage for setting up symlinks by navigating to the scripts directory and running `setup-symlinks.ps1`. Ensure PowerShell is run as Administrator on Windows if needed. ```powershell # Navigate to the scripts directory cd MovieCollectionApp/angular/scripts # Setup symlinks (run this first) ./setup-symlinks.ps1 # Remove symlinks when done ./remove-symlinks.ps1 ``` -------------------------------- ### Start Dapr Client App Source: https://github.com/abpframework/abp-samples/blob/master/Dapr/Service-invocation/README.md Use this command to start your Dapr client application. This command assumes your client application is a .NET project. ```bash dapr run --app-id dapr-client --dapr-http-port 3600 dotnet run --project DaprClient\DaprClient.csproj ``` -------------------------------- ### Get Angular CLI Help Source: https://github.com/abpframework/abp-samples/blob/master/AcmeBookStoreAngularMaterial/angular/README.md Displays help information for the Angular CLI. ```bash ng help ``` -------------------------------- ### Run Azure Service Bus Docker Compose Source: https://github.com/abpframework/abp-samples/blob/master/DynamicDistributedEvents/README.md Starts the SQL Server and Service Bus emulator using Docker Compose. A 30-second delay is included for initialization. ```bash docker compose up -d servicebus-sql servicebus-emulator sleep 30 ``` -------------------------------- ### Start Redis with Docker Source: https://github.com/abpframework/abp-samples/blob/master/Dapr/PubSub/README.md Run a Redis instance in Docker for Dapr pub/sub. Ensure the port is exposed for Dapr to connect. ```bash docker run -d --name dapr-sub-pub -p 6973:6379 redis ``` -------------------------------- ### Run Kafka Docker Compose Source: https://github.com/abpframework/abp-samples/blob/master/DynamicDistributedEvents/README.md Starts Kafka and ZooKeeper services using Docker Compose. A 15-second delay is included to allow services to initialize. ```bash docker compose up -d zookeeper kafka sleep 15 ``` -------------------------------- ### Start Dapr HTTP API Source: https://github.com/abpframework/abp-samples/blob/master/Dapr/Service-invocation/README.md Use this command to start your Dapr HTTP API application. Ensure the app-port matches your application's listening port. ```bash dapr run --app-id dapr-httpapi --app-port 7086 --dapr-http-port 3500 --app-ssl dotnet run --project DaprHttpApi\DaprHttpApi.csproj ``` -------------------------------- ### Get Products in OU Including Children Source: https://github.com/abpframework/abp-samples/blob/master/OrganizationUnitSample/README.md Introduces a method to a domain service to retrieve products from a specified organization unit and all its child organization units. Requires `IOrganizationUnitRepository` and `IProductRepository`. ```csharp public class ProductManager : DomainService { private readonly IProductRepository _productRepository; private readonly IOrganizationUnitRepository _organizationUnitRepository; public ProductManager(IProductRepository productRepository, IOrganizationUnitRepository organizationUnitRepository) { _productRepository = productRepository; _organizationUnitRepository = organizationUnitRepository; } public virtual async Task> GetProductsInOuIncludingChildrenAsync( OrganizationUnit organizationUnit) { var ouIds = (await _organizationUnitRepository.GetAllChildrenWithParentCodeAsync( organizationUnit.Code, organizationUnit.ParentId)) .Select(ou => ou.Id).ToList(); return await AsyncExecuter.ToListAsync(_productRepository.Where(p => ouIds.Contains(p.OrganizationUnitId))); } } ``` -------------------------------- ### Configure BookStore DbContext Source: https://context7.com/abpframework/abp-samples/llms.txt Integrates Entity Framework Core DbContext with ABP modules and configures application entities like Books and Authors. Requires ABP and EF Core setup. ```csharp using Acme.BookStore.Authors; using Acme.BookStore.Books; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.Identity; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace Acme.BookStore.EntityFrameworkCore; [ReplaceDbContext(typeof(IIdentityDbContext))] [ReplaceDbContext(typeof(ITenantManagementDbContext))] [ConnectionStringName("Default")] public class BookStoreDbContext : AbpDbContext, IIdentityDbContext, ITenantManagementDbContext { // Module entities public DbSet Users { get; set; } public DbSet Roles { get; set; } public DbSet Tenants { get; set; } // Application entities public DbSet Books { get; set; } public DbSet Authors { get; set; } public BookStoreDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Configure ABP modules builder.ConfigurePermissionManagement(); builder.ConfigureSettingManagement(); builder.ConfigureIdentity(); builder.ConfigureTenantManagement(); // Configure application entities builder.Entity(b => { b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.HasOne().WithMany().HasForeignKey(x => x.AuthorId).IsRequired(); }); builder.Entity(b => { b.ToTable(BookStoreConsts.DbTablePrefix + "Authors", BookStoreConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.Name).IsRequired().HasMaxLength(AuthorConsts.MaxNameLength); b.HasIndex(x => x.Name); }); } } ``` -------------------------------- ### Run Docker Images with Docker-Compose Source: https://github.com/abpframework/abp-samples/blob/master/ModularCRM/README.md Navigate to the etc/docker directory and run this script to start the application's Docker containers. It generates developer certificates if needed and runs in detached mode. ```powershell run-docker.ps1 ``` -------------------------------- ### Start Dapr Publisher Application Source: https://github.com/abpframework/abp-samples/blob/master/Dapr/PubSub/README.md Launch the Dapr publisher application using the Dapr CLI. This command specifies the app ID, component path, and Dapr ports, then runs the .NET project. ```bash dapr run --app-id dapr-publisher --components-path dapr/components/ --dapr-http-port 8002 --dapr-grpc-port 8003 -- dotnet run --project DaprPublisher\DaprPublisher.csproj ``` -------------------------------- ### Domain Service to Get Products in an Organization Unit Source: https://github.com/abpframework/abp-samples/blob/master/OrganizationUnitSample/README.md Implement a domain service to retrieve entities filtered by their OrganizationUnitId. Consider repository pattern for better performance. ```csharp public class ProductManager : IDomainService { private readonly IProductRepository _productRepository; public ProductManager(IProductRepository productRepository) { _productRepository = productRepository; } public virtual Task> GetProductsInOuAsync(OrganizationUnit organizationUnit) { return await AsyncExecuter.ToListAsync(_productRepository.Where(p => p.OrganizationUnitId == organizationUnit.Id)); } } ``` -------------------------------- ### Implement Data Seed Contributor Source: https://github.com/abpframework/abp-samples/blob/master/MAUI-OpenId/Part 2.md Implement IDataSeedContributor to seed example user data. Ensure IIdentityUserRepository and IGuidGenerator are injected. ```csharp public class UsersDataSeederContributor : IDataSeedContributor, ITransientDependency { protected IIdentityUserRepository repository; protected IGuidGenerator guidGenerator; public UsersDataSeederContributor(IIdentityUserRepository repository, IGuidGenerator guidGenerator) { this.repository = repository; this.guidGenerator = guidGenerator; } public async Task SeedAsync(DataSeedContext context) { var count = await repository.GetCountAsync(); if(count <= 1) // Not sure 'admin' user was seeded before or not. { // All the names below were generated by https://www.name-generator.org.uk/quick/ // The names does not represent real people. await repository.InsertManyAsync(new []{ new IdentityUser(guidGenerator.Create(), "john.doe", "john.doe@abp.io"), new IdentityUser(guidGenerator.Create(), "Zane.Frost", "Zane.Frost@abp.io"), new IdentityUser(guidGenerator.Create(), "Oscar.Landry", "Oscar.Landry@abp.io"), new IdentityUser(guidGenerator.Create(), "Yasemin.Roberts", "Yasemin.Roberts@abp.io"), new IdentityUser(guidGenerator.Create(), "Yasmine.Perez", "Yasmine.Perez@abp.io"), new IdentityUser(guidGenerator.Create(), "Tobi.Becker", "Tobi.Becker@abp.io"), new IdentityUser(guidGenerator.Create(), "Fox.Gilmore", "Fox.Gilmore@abp.io"), new IdentityUser(guidGenerator.Create(), "Benny.Burris", "Benny.Burris@abp.io"), new IdentityUser(guidGenerator.Create(), "Chad.Camacho", "Chad.Camacho@abp.io"), }); } } } ``` -------------------------------- ### Implement Event Service for Upcoming Events Source: https://github.com/abpframework/abp-samples/blob/master/EventOrganizer/docs/Notes.md Implements the IEventAppService to fetch and map upcoming events. It uses a repository to query events ordered by start time and maps them to EventDto. ```csharp using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Domain.Repositories; namespace EventOrganizer.Events { public class EventAppService : EventOrganizerAppService, IEventAppService { private readonly IRepository _eventRepository; public EventAppService(IRepository eventRepository) { _eventRepository = eventRepository; } [Authorize] public async Task CreateAsync(EventCreationDto input) { var eventEntity = ObjectMapper.Map(input); await _eventRepository.InsertAsync(eventEntity); return eventEntity.Id; } public async Task> GetUpcomingAsync() { var events = await AsyncExecuter.ToListAsync( _eventRepository .Where(x => x.StartTime > Clock.Now) .OrderBy(x => x.StartTime) ); return ObjectMapper.Map, List>(events); } } } ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/README.md Clone the ABP Framework sample repository and navigate into the project directory. ```bash git clone cd MovieCollectionApp ``` -------------------------------- ### Get Resolution As Object Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Gets the resolution of a value as an object, considering the expected type ID. ```csharp at Npgsql.Internal.PgResolverTypeInfo.GetResolutionAsObject(Object value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Get Object Relation Resolution Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Gets the object relation resolution for a given value. This is used in object-relational mapping scenarios. ```csharp npgsql.PgTypeInfo.GetObjectRelationResolution(object value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Main Program Entry Point Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt The main entry point for the GymWorkoutPlanner program. ```csharp at GymWorkoutPlanner.Program.Main(String[] args) in D:\Github\abp-samples\StudioAiGeneratedProjects\GymWorkoutPlanner\GymWorkoutPlanner\Program.cs:line 50 ``` -------------------------------- ### Migrate Database and Seed Data Source: https://github.com/abpframework/abp-samples/blob/master/AIChat/README.md Run the application with the --migrate-database flag to create and seed the initial database. This is often done automatically during solution creation. ```bash dotnet run --migrate-database ``` -------------------------------- ### Get Products for a Specific User Source: https://github.com/abpframework/abp-samples/blob/master/OrganizationUnitSample/README.md A domain service method to retrieve all products associated with the organization units a given user belongs to. It utilizes `IdentityUserManager` to get user details and the `IProductRepository` for data retrieval. ```csharp public class ProductManager : DomainService { private readonly IProductRepository _productRepository; private readonly IdentityUserManager _userManager; public ProductManager(IProductRepository productRepository, IdentityUserManager userManager) { _productRepository = productRepository; _organizationUnitRepository = organizationUnitRepository; _userManager = userManager; } public virtual async Task> GetProductForUserAsync(Guid userId) { var user = await _userManager.GetByIdAsync(userId); var userOuIds = user.OrganizationUnits.Select(ou => ou.OrganizationUnitId); return await _productRepository.GetProductsOfOrganizationUnitListAsync(userOuIds.ToList()); } } ``` -------------------------------- ### Create New ABP Application with Blazor and MongoDB Source: https://github.com/abpframework/abp-samples/blob/master/EventOrganizer/docs/Notes.md Use the ABP CLI to generate a new application project. This command specifies Blazor as the UI framework and MongoDB as the database provider. The --preview flag indicates the use of a preview version. ```bash abp new EventOrganizer -u blazor -d mongodb --preview ``` -------------------------------- ### Build Catalog Project Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.catalog/angular/projects/catalog/README.md Builds the catalog project. Artifacts are stored in the dist/ directory. ```bash ng build catalog ``` -------------------------------- ### Get Object Resolution Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves the resolution of an object value. ```csharp at Npgsql.PgTypeInfo.GetObjectResolution(Object value) ``` -------------------------------- ### Get Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves a value based on type information. This is a general-purpose retrieval method. ```csharp npgsql.PgConverterResolver.Get(DateTime value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Build Ordering Project Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.ordering/angular/projects/ordering/README.md Builds the 'ordering' project. Artifacts are stored in the dist/ directory. This command is essential before publishing. ```bash ng build ordering ``` -------------------------------- ### Basic Usage of Symlink Scripts Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/EventRegistration/angular/scripts/README.md Navigate to the scripts directory and execute `setup-symlinks.ps1` to create symlinks, and `remove-symlinks.ps1` to clean them up. Ensure PowerShell is run as Administrator on Windows if needed. ```powershell # Navigate to the scripts directory cd EventRegistration/angular/scripts # Setup symlinks (run this first) ./setup-symlinks.ps1 # Remove symlinks when done ./remove-symlinks.ps1 ``` -------------------------------- ### Run Blazor Server Project Source: https://github.com/abpframework/abp-samples/blob/master/UrlBasedLocalization/README.md Command to run the Blazor Server project for testing URL-based localization. ```bash dotnet run --project src/BookStore.Blazor.Server ``` -------------------------------- ### Publish Ordering Library Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.ordering/angular/projects/ordering/README.md Publishes the built 'ordering' library to npm. Navigate to the dist/ordering directory after building and then run npm publish. ```bash cd dist/ordering && npm publish ``` -------------------------------- ### Get Object Internally Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves an object internally based on type information, value, and expected type ID. ```csharp at Npgsql.Internal.PgConverterResolver`1.GetAsObjectInternal(PgTypeInfo typeInfo, Object value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Get Value Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves a value, potentially handling nullability and expected types. This is used in data retrieval and conversion. ```csharp npgsql.PgConverterResolver.Get(T value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Run Blazor WebApp Project Source: https://github.com/abpframework/abp-samples/blob/master/UrlBasedLocalization/README.md Command to run the Blazor WebApp project for testing URL-based localization. ```bash dotnet run --project src/BookStore.Blazor.WebApp ``` -------------------------------- ### Get Resolver Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves a resolver for a given type. This is used for converting data between .NET types and database types. ```csharp npgsql.PgConverter.GetResolver(Nullable`1 expectedPgTypeId) ``` ```csharp npgsql.PgResolverTypeInfo.GetResolver(object value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Run All Tests Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/README.md Execute all unit and integration tests for the project. ```bash dotnet test ``` -------------------------------- ### Run MVC Project Source: https://github.com/abpframework/abp-samples/blob/master/UrlBasedLocalization/README.md Command to run the MVC project for testing URL-based localization. ```bash dotnet run --project src/BookStore.Mvc ``` -------------------------------- ### Get Object Internal Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Retrieves an object internally, considering type information and expected types. This is used for internal data handling. ```csharp npgsql.PgConverterResolver.GetObjectInternal(PgTypeInfo typeInfo, object value, Nullable`1 expectedPgTypeId) ``` -------------------------------- ### Create User Async with Password Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Asynchronously creates a user with a specified email, password, and optional tenant ID. Includes password validation. ```csharp at Volo.Abp.Identity.IdentityUserManager.CreateAsync(IdentityUser user, string password, bool validatePassword) in D:\Github\abp\modules\identity\src\Volo.Abp.Identity.Domain\Volo\Abp\Identity\IdentityUserManager.cs:line 93 ``` -------------------------------- ### Create New ABP Application with Blazor UI Source: https://github.com/abpframework/abp-samples/blob/master/BlazorWasmAspNetCoreHosted/POST.md Use the ABP CLI to generate a new application with Blazor UI. Specify the template, version, and disable random ports. ```bash abp new BookStore -u blazor -t app -v 6.0.0-rc.2 --no-random-port ``` -------------------------------- ### Resolve Date/Time Converter for Npg્સql Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/GymWorkoutPlanner/migrate-output.txt Resolve the Date/Time converter for Npg્સql. This involves getting the converter based on the value, expected type, and a validation flag. ```C# c.c.CreateResolver( DateTimeConverterResolver`1 resolver, DateTime value, Nullable`1 expectedPgTypeId ); ``` -------------------------------- ### Generate Component for Ordering Project Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.ordering/angular/projects/ordering/README.md Use this command to generate a new component within the 'ordering' project. Ensure the --project flag is used to target the correct project. ```bash ng generate component component-name --project ordering ``` -------------------------------- ### Run Database Migrator Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/MovieCollectionApp/README.md Execute the database migrator to set up the MongoDB database and seed initial data. ```bash dotnet run --project src/MovieCollectionApp.DbMigrator ``` -------------------------------- ### Configure Mapperly Mappings in C# Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/PersonalBudget/ai-assistant/plan.md Define object-to-object mappings using Mapperly for efficient data transfer between entities and DTOs. This example shows mapping for Category and Expense objects. ```csharp public partial class PersonalBudgetWebMappers : Profile { public PersonalBudgetWebMappers() { // Category -> CategoryDto CreateMap(); // CreateUpdateCategoryDto -> Category (for update) CreateMap(); // Expense -> ExpenseDto CreateMap(); // CreateUpdateExpenseDto -> Expense CreateMap(); // Category -> CategoryLookupDto CreateMap(); } } ``` -------------------------------- ### Create Event Blazor Component Source: https://github.com/abpframework/abp-samples/blob/master/EventOrganizer/docs/Notes.md A Blazor component for creating new events. It uses `EditForm` to bind to an `EventCreationDto` and includes fields for title, description, free status, and start time. ```razor @page "/create-event" @inherits EventOrganizerComponentBase Create Event
@L["Title"] @L["Description"] @L["Free"] @L["StartTime"]
``` -------------------------------- ### Add HttpApi.Client Project Reference Source: https://github.com/abpframework/abp-samples/blob/master/MAUI-OpenId/Part 2.md Reference the HttpApi.Client project to allow the MAUI application to communicate with the backend API. Run 'abp build' afterwards. ```xml ``` -------------------------------- ### Start Dapr Subscriber Application Source: https://github.com/abpframework/abp-samples/blob/master/Dapr/PubSub/README.md Launch the Dapr subscriber application using the Dapr CLI. This command specifies the app ID, component path, ports, and the .NET project to run. ```bash dapr run --app-id dapr-subscribe --components-path dapr/components/ --app-port 7001 --dapr-http-port 7002 --dapr-grpc-port 7003 -- dotnet run --project DaprSubscribe\DaprSubscribe.csproj ``` -------------------------------- ### Create BookStoreMauiClientModule Source: https://github.com/abpframework/abp-samples/blob/master/MAUI-OpenId/Part 2.md Define the main ABP module for the MAUI client. This module configures dependency injection, Oidc client options, and HTTP client settings. ```csharp using IdentityModel.OidcClient; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Volo.Abp.Autofac; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Modularity; namespace Acme.BookStore.MauiClient; [DependsOn( typeof(AbpAutofacModule), typeof(AbpHttpClientIdentityModelModule), typeof(BookStoreHttpApiClientModule) )] public class BookStoreMauiClientModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); Configure(configuration.GetSection("Oidc:Options")); context.Services.AddTransient(sp => { var options = sp.GetRequiredService>().Value; options.Browser = sp.GetRequiredService(); return new OidcClient(options); }); context.Services.AddTransient(sp => new HttpClient(sp.GetRequiredService()) { // Temporarily. We'll use ABP's Proxy for sendind requests. BaseAddress = new Uri(configuration.GetValue("RemoteServices:Default:BaseUrl")) }); } } ``` -------------------------------- ### Configure Application Module Dependencies in C# Source: https://context7.com/abpframework/abp-samples/llms.txt Configure application module dependencies by inheriting from AbpModule and using the DependsOn attribute. This example shows how to include various ABP and domain-specific modules. ```csharp using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; using Volo.Abp.TenantManagement; namespace Acme.BookStore; [DependsOn( typeof(BookStoreDomainModule), typeof(AbpAccountApplicationModule), typeof(BookStoreApplicationContractsModule), typeof(AbpIdentityApplicationModule), typeof(AbpPermissionManagementApplicationModule), typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) )] public class BookStoreApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { // Configure application-specific services } } ``` -------------------------------- ### Initialize ABP Application in MauiProgram Source: https://github.com/abpframework/abp-samples/blob/master/MAUI-OpenId/Part 2.md Modify the MauiProgram.cs file to configure the Autofac service provider, set up the application configuration, and initialize the ABP application with external services. ```csharp using Microsoft.Extensions.Configuration; using Microsoft.Extensions.FileProviders; using System.Reflection; using Volo.Abp; using Volo.Abp.Autofac; namespace Acme.BookStore.MauiClient; public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder.ConfigureContainer(new AbpAutofacServiceProviderFactory(new Autofac.ContainerBuilder()), containerBuilder => { }); builder .UseMauiApp() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); }); ConfigureConfiguration(builder); builder.Services.AddApplication(options => { options.Services.ReplaceConfiguration(builder.Configuration); }); var app = builder.Build(); app.Services.GetRequiredService() .Initialize(app.Services); return app; } private static void ConfigureConfiguration(MauiAppBuilder builder) { var assembly = typeof(App).GetTypeInfo().Assembly; builder.Configuration.AddJsonFile(new EmbeddedFileProvider(assembly), "appsettings.json", optional: false, false); } } ``` -------------------------------- ### Define Event Aggregate Root Entity Source: https://github.com/abpframework/abp-samples/blob/master/EventOrganizer/docs/Notes.md Defines the `Event` entity, inheriting from `FullAuditedAggregateRoot`. It includes properties for title, description, free status, start time, and a collection of attendees. This is a core domain entity. ```csharp using System; using System.Collections.Generic; using Volo.Abp.Domain.Entities.Auditing; namespace EventOrganizer.Events { public class Event : FullAuditedAggregateRoot { public string Title { get; set; } public string Description { get; set; } public bool IsFree { get; set; } public DateTime StartTime { get; set; } public ICollection Attendees { get; set; } public Event() { Attendees = new List(); } } } ``` -------------------------------- ### Run Unit Tests for Ordering Project Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.ordering/angular/projects/ordering/README.md Executes unit tests for the 'ordering' project using Karma. This command helps ensure the library's components function as expected. ```bash ng test ordering ``` -------------------------------- ### Publish Catalog Library Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.catalog/angular/projects/catalog/README.md After building the library, navigate to the dist/catalog directory and run npm publish to make it available. ```bash cd dist/catalog && npm publish ``` -------------------------------- ### Define Custom Application Service Interface - ITodoAppService Source: https://context7.com/abpframework/abp-samples/llms.txt Defines a custom application service interface 'ITodoAppService' for managing 'TodoItem' entities. It includes methods for getting a list, creating, and deleting todo items. ```csharp // Custom application service interface public interface ITodoAppService : IApplicationService { Task> GetListAsync(); Task CreateAsync(string text); Task DeleteAsync(Guid id); } ``` -------------------------------- ### Implement Book CRUD Application Service Source: https://context7.com/abpframework/abp-samples/llms.txt Implements a Book Application Service using the CrudAppService base class, providing automatic CRUD operations with authorization. Includes custom logic for Get and GetList operations to include author names. ```csharp using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Acme.BookStore.Authors; using Acme.BookStore.Permissions; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; namespace Acme.BookStore.Books; [Authorize(BookStorePermissions.Books.Default)] public class BookAppService : CrudAppService, IBookAppService { private readonly IAuthorRepository _authorRepository; public BookAppService( IRepository repository, IAuthorRepository authorRepository) : base(repository) { _authorRepository = authorRepository; // Configure authorization policies for each operation GetPolicyName = BookStorePermissions.Books.Default; GetListPolicyName = BookStorePermissions.Books.Default; CreatePolicyName = BookStorePermissions.Books.Create; UpdatePolicyName = BookStorePermissions.Books.Edit; DeletePolicyName = BookStorePermissions.Books.Delete; } public override async Task GetAsync(Guid id) { var queryable = await Repository.GetQueryableAsync(); var query = from book in queryable join author in await _authorRepository.GetQueryableAsync() on book.AuthorId equals author.Id where book.Id == id select new { book, author }; var queryResult = await AsyncExecuter.FirstOrDefaultAsync(query); if (queryResult == null) { throw new EntityNotFoundException(typeof(Book), id); } var bookDto = ObjectMapper.Map(queryResult.book); bookDto.AuthorName = queryResult.author.Name; return bookDto; } public override async Task> GetListAsync(PagedAndSortedResultRequestDto input) { var queryable = await Repository.GetQueryableAsync(); var query = from book in queryable join author in await _authorRepository.GetQueryableAsync() on book.AuthorId equals author.Id select new { book, author }; query = query .OrderBy(NormalizeSorting(input.Sorting)) .Skip(input.SkipCount) .Take(input.MaxResultCount); var queryResult = await AsyncExecuter.ToListAsync(query); var bookDtos = queryResult.Select(x => { var bookDto = ObjectMapper.Map(x.book); bookDto.AuthorName = x.author.Name; return bookDto; }).ToList(); var totalCount = await Repository.GetCountAsync(); return new PagedResultDto(totalCount, bookDtos); } public async Task> GetAuthorLookupAsync() { var authors = await _authorRepository.GetListAsync(); return new ListResultDto( ObjectMapper.Map, List>(authors) ); } } ``` -------------------------------- ### SignalR Hub Integration Source: https://context7.com/abpframework/abp-samples/llms.txt Demonstrates integrating SignalR with ABP's authentication and user management. Requires `AbpHub` base class and dependency injection for user lookup. ```csharp using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.SignalR; using Volo.Abp.AspNetCore.SignalR; using Volo.Abp.Identity; namespace SignalRDemo.Web; [Authorize] public class ChatHub : AbpHub { private readonly IIdentityUserRepository _identityUserRepository; private readonly ILookupNormalizer _lookupNormalizer; public ChatHub( IIdentityUserRepository identityUserRepository, ILookupNormalizer lookupNormalizer) { _identityUserRepository = identityUserRepository; _lookupNormalizer = lookupNormalizer; } public async Task SendMessage(string targetUserName, string message) { var targetUser = await _identityUserRepository.FindByNormalizedUserNameAsync( _lookupNormalizer.NormalizeName(targetUserName)); message = $"{CurrentUser.UserName}: {message}"; await Clients .User(targetUser.Id.ToString()) .SendAsync("ReceiveMessage", message); } } ``` -------------------------------- ### Generate Development Signing Certificate Source: https://github.com/abpframework/abp-samples/blob/master/StudioAiGeneratedProjects/GymWorkoutPlanner/README.md Use this command to generate a PFX file for OpenIddict signing and encryption. Replace the password with your desired secret. ```bash dotnet dev-certs https -v -ep openiddict.pfx -p 9a33a832-496b-4ac7-b026-e1812a95bdb6 ``` -------------------------------- ### Implement Repository Method for Organization Unit Query (EntityFrameworkCore) Source: https://github.com/abpframework/abp-samples/blob/master/OrganizationUnitSample/README.md Implement the repository method using EntityFrameworkCore to efficiently query entities associated with a specific organization unit. ```csharp public async Task> GetProductsInOrganizationUnitAsync(Guid organizationUnitId) { return await DbSet.Where(p => p.OrganizationUnitId == organizationUnitId).ToListAsync(); } ``` -------------------------------- ### Run Unit Tests Source: https://github.com/abpframework/abp-samples/blob/master/NG.ModularCRM/modules/modularcrm.catalog/angular/projects/catalog/README.md Executes unit tests for the catalog project using Karma. ```bash ng test catalog ``` -------------------------------- ### Generate Signing Certificate Source: https://github.com/abpframework/abp-samples/blob/master/BookStore-Blazor-EfCore/README.md Use this command to generate a signing certificate for production environments. Replace the placeholder password with your desired password. ```bash dotnet dev-certs https -v -ep openiddict.pfx -p 0bc9a38b-d740-4abc-81e8-2c78dc44e970 ``` -------------------------------- ### Configure Tenant Resolution for Sign-In Source: https://github.com/abpframework/abp-samples/blob/master/SignInWithoutSpecifyingTenant/OpenIddict/README.md Clear existing tenant resolvers and add `CurrentUserTenantResolveContributor` to resolve the tenant based on the current user. This is typically done during application startup. ```cs public override void ConfigureServices(ServiceConfigurationContext context) { //... context.Services.Configure(options => { options.TenantResolvers.Clear(); options.TenantResolvers.Add(new CurrentUserTenantResolveContributor()); }); //... } ``` -------------------------------- ### API Versioning with Controllers Source: https://context7.com/abpframework/abp-samples/llms.txt Demonstrates API versioning using attributes on controllers. Supports multiple versions, including deprecated ones. ```csharp using System.Threading.Tasks; using Asp.Versioning; using Microsoft.AspNetCore.Mvc; using Volo.Abp; namespace BookStore.Books; // Version 1.0 (Deprecated) [Area(BookStoreRemoteServiceConsts.ModuleName)] [RemoteService(Name = BookStoreRemoteServiceConsts.RemoteServiceName)] [ApiVersion("1.0", Deprecated = true)] [ApiController] [ControllerName("Book")] [Route("api/BookStore/Book")] public class BookController : BookStoreController, IBookAppService { private readonly IBookAppService _bookAppService; public BookController(IBookAppService bookAppService) { _bookAppService = bookAppService; } [HttpGet] public async Task GetAsync() { return await _bookAppService.GetAsync(); } } // Version 2.0 with additional endpoints [Area(BookStoreRemoteServiceConsts.ModuleName)] [RemoteService(Name = BookStoreRemoteServiceConsts.RemoteServiceName)] [ApiVersion("2.0")] [ApiController] [ControllerName("Book")] [Route("api/BookStore/Book")] public class BookV2Controller : BookStoreController, IBookV2AppService { private readonly IBookV2AppService _bookAppService; public BookV2Controller(IBookV2AppService bookAppService) { _bookAppService = bookAppService; } [HttpGet] public async Task GetAsync() { return await _bookAppService.GetAsync(); } [HttpGet] [Route("{isbn}")] public async Task GetAsync(string isbn) { return await _bookAppService.GetAsync(isbn); } } // URL-based versioning with controllers [ApiController] [ApiVersion("1.0")] [ApiVersion("0.9", Deprecated = true)] [Route("api/v{version:apiVersion}/People")] [ControllerName("People")] public class PeopleController : ControllerBase { [HttpGet("{id:int}")] [Produces("application/json")] [ProducesResponseType(typeof(Person), 200)] [ProducesResponseType(404)] public IActionResult Get(int id) => Ok(new Person { Id = id, FirstName = "John", LastName = "Doe" }); } ```