Currently trying to describe enum models in Swagger, don't want to change the API parameters, they should still use and return integers, but the description should show which integer means what.
I've tried this
options.SchemaFilter<EnumSchemaFilter>();
public class EnumSchemaFilter : ISchemaFilter
{
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
{
if (context.Type.IsEnum)
{
var array = new OpenApiArray();
array.AddRange(Enum.GetNames(context.Type).Select(n => new OpenApiString(n)));
// NSwag
schema.Extensions.Add("x-enumNames", array);
// Openapi-generator
schema.Extensions.Add("x-enum-varnames", array);
}
}
}
Also tried using the package Unchase.Swashbuckle.AspNetCore.Extensions
options.AddEnumsWithValuesFixFilters();
But results are the same, no change
Enum models are still
The issue seems to be on firefox. Working correctly on chrome. Thanks for looking into it, closing.
ABP Suite 8.0.4
I choose my entity name and all my options, then move to Properties tab, but I lose all my changes in Entity Info tab. If I click Save on the properties tab, it doesn't work, because all my changes in Entity info are gone, and vice versa, my changes in Properties tab are lost when i go to Entity info tab.
Edit: It seems page / content seems to refresh on tab change
Thank you!
I extended the existing IdentityUser with the extension system, and also had it mapped to a different column using ef core mapping, which is working fine for the UI side as well
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<Guid?>(
"ClassroomId",
property =>
{
//property.Attributes.Add(new RequiredAttribute());
//validation rules
property.DisplayName = new FixedLocalizableString("Classroom");
property.UI.Lookup.Url = "/api/app/classrooms";
property.UI.Lookup.DisplayPropertyName = "name";
property.UI.Lookup.FilterParamName = "filterText";
}
);
});
});
ObjectExtensionManager.Instance
.MapEfCoreProperty<IdentityUser, Guid?>(
"ClassroomId",
(entityBuilder, propertyBuilder) =>
{
entityBuilder
.HasOne(typeof(Classroom))
.WithMany()
.HasForeignKey("ClassroomId");
}
);
How to query on that property when querying from database directly and not using client side evaluation?
The doc mentions 'Another approach can be creating your own entity mapped to the same database table (or collection for a MongoDB database).`
Tried by making a class AppUser that inherits from IdentityUser mapped to the same table 'AbpUsers' however that makes a discriminator column, and queries with the new class dont bring out all records, which I think is expected from EF Core TablePerHierarchy.
What's the ideal solution for querying something like this?
var users = await Users.Where(x=> x.GetClassroomId() == classId).ToListAsync();
public static class IdentityUserExtensions
{
private const string ClassroomIdPropertyName = "ClassroomId";
public static void SetClassroomId(this IdentityUser user, Guid? classroomId)
{
user.SetProperty(ClassroomIdPropertyName, classroomId);
}
public static Guid? GetClassroomId(this IdentityUser user)
{
return user.GetProperty<Guid?>(ClassroomIdPropertyName);
}
}
Also I would rather not go for a new New Entity with Its Own Database Table, and using local bus to keep them synchronized, unless its the last option
ABP Suite CRUD pages to create boilerplate is pretty good at the start of a project with the started entities.
However for example if there's custom logic in any of those rendered code, it will get overwritten, if for example a new field is added into an entity, and the code is regenerated. Is there a good way to handle this situation, or is auto CRUD functionality only for the very beginning?
Hi, can you try first logout and then login ?
abp logout abp login <username> -p <password> -o <organization-name>
Not working
Also tried on a fresh machine by installing ABP CLI, and trying to login, same error
Having the same issue here