Starts in:
2 DAYS
0 HR
14 MIN
59 SEC
Starts in:
2 D
0 H
14 M
59 S

Activities of "Moyaoxiang"

Hi Repunjay, The current framework does not have this feature, you have to implement it yourself. You can judge whether the user is logging in for the first time based on the information in the Security Log, or extend User to add a bool attribute IsFirstLogin. If it is the first login, you can inject the IdentityUserManager and use the ResetPasswordAsync() method to reset the password.

Hi aidid, It is not recommended to directly use the ABP vNext dynamic proxy API function to call external APIs. If you want to achieve a similar function, you can try https://github.com/reactiveui/refit

Hi suraj.kumbhar, Due to the generic constraints of IRepository, the entity class must inherit from the IEntity/IEntity<TKey> interface. If you need to create an entity class that does not inherit from IEntity, you can only access entity data through DbContext. e.g.

public class CustomRepository : ICustomRepository
{
    private readonly IDbContextProvider<IoTProjectDbContext> _dbContextProvider;

    protected virtual Task<IoTProjectDbContext> GetDbContextAsync()
    {
        return _dbContextProvider.GetDbContextAsync();
    }

    public CustomRepository(IDbContextProvider<IoTProjectDbContext> dbContextProvider)
    {
        _dbContextProvider = dbContextProvider;
    }

    public async Task<DeviceTests> GetAsync(long id)
    {
        var provider = await GetDbContextAsync();
        return await provider.DeviceTests.FirstOrDefaultAsync(e => e.Id == id);
    }
}

Hi safi, You can get the file version through GetFileVersion() and return it to the front-end page.

var version = typeof(AbpModule).Assembly.GetFileVersion();

Hi @dweinand, @hikalkan has raised an Issue for this issue, and there is currently no confirmed support for Duende.

Hi DanielAndreasen , You should change @inject IHtmlLocalizer<AccountResource> L to @inject IHtmlLocalizer<WebResource> L.

Hi gvnuysal, This is not a good practice, you can refer to this Issue to operate, it can work normally in my project. DeviceEntity

public class Device : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
    public virtual Guid? TenantId { get; set; }

    [NotNull] public virtual string Name { get; set; }

    public virtual AppUser User { get; set; }

    public virtual Guid AppUserId { get; set; }

    public virtual IdentityRole Role { get; set; }

    public virtual Guid RoleId { get; set; }

    public Device()
    {
    }

    public Device(Guid id, string name)
    {
        Id = id;
        Check.NotNull(name, nameof(name));
        Check.Length(name, nameof(name), DeviceConsts.NameMaxLength, 0);
        Name = name;
    }
}

MigrationsDbContext

public class IoTProjectMigrationsDbContext : AbpDbContext<IoTProjectMigrationsDbContext>
{
    public IoTProjectMigrationsDbContext(DbContextOptions<IoTProjectMigrationsDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        /* Include modules to your migration db context */

        builder.ConfigurePermissionManagement();
        builder.ConfigureSettingManagement();
        builder.ConfigureBackgroundJobs();
        builder.ConfigureAuditLogging();
        builder.ConfigureIdentity();
        builder.ConfigureIdentityServer();
        builder.ConfigureFeatureManagement();
        builder.ConfigureLanguageManagement();
        builder.ConfigureSaas();
        builder.ConfigureTextTemplateManagement();
        builder.ConfigureBlobStoring();

        /* Configure your own tables/entities inside the ConfigureIoTProject method */

        builder.Entity<AppUser>(b =>
        {
            b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser

            b.ConfigureByConvention();
            b.ConfigureAbpUser();
            b.HasOne<IdentityUser>().WithOne().HasForeignKey<AppUser>(e => e.Id);

            /* Configure mappings for your additional properties.
                * Also see the IoTProjectEfCoreEntityExtensionMappings class.
                */
        });
        
        builder.ConfigureIoTProject();
    }
}

DbContextModelCreatingExtensions

public static class IoTProjectDbContextModelCreatingExtensions
{
    public static void ConfigureIoTProject(this ModelBuilder builder)
    {
        Check.NotNull(builder, nameof(builder));

        /* Configure your own tables/entities inside here */

        //builder.Entity<YourEntity>(b =>
        //{
        //    b.ToTable(IoTProjectConsts.DbTablePrefix + "YourEntities", IoTProjectConsts.DbSchema);
        //    b.ConfigureByConvention(); //auto configure for the base class props
        //    //...
        //});

        builder.Entity<Device>(b =>
        {
            b.ToTable(IoTProjectConsts.DbTablePrefix + "Devices", IoTProjectConsts.DbSchema);
            b.ConfigureByConvention();
            b.Property(x => x.TenantId).HasColumnName(nameof(Device.TenantId));
            b.Property(x => x.Name).HasColumnName(nameof(Device.Name)).IsRequired().HasMaxLength(DeviceConsts.NameMaxLength);
            
            b.HasOne(x=>x.User).WithMany().HasForeignKey(x => x.AppUserId);
            b.HasOne(x=>x.Role).WithMany().HasForeignKey(x => x.RoleId);
        });
    }
}

DbContext

[ConnectionStringName("Default")]
public class IoTProjectDbContext : AbpDbContext<IoTProjectDbContext>
{
    public DbSet<Device> Devices { get; set; }
    public DbSet<AppUser> Users { get; set; }

    /* Add DbSet properties for your Aggregate Roots / Entities here.
        * Also map them inside IoTProjectDbContextModelCreatingExtensions.ConfigureIoTProject
        */

    public IoTProjectDbContext(DbContextOptions<IoTProjectDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        /* Configure the shared tables (with included modules) here */

        builder.Entity<AppUser>(b =>
        {
            b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser

            b.ConfigureByConvention();
            b.ConfigureAbpUser();

            /* Configure mappings for your additional properties.
                * Also see the IoTProjectEfCoreEntityExtensionMappings class.
                */
        });

        /* Configure your own tables/entities inside the ConfigureIoTProject method */

        var options = new IdentityModelBuilderConfigurationOptions(
            AbpIdentityDbProperties.DbTablePrefix,
            AbpIdentityDbProperties.DbSchema
        );
        
        builder.Entity<IdentityRole>(b =>
        {
            b.ToTable(options.TablePrefix + "Roles", options.Schema);

            b.ConfigureByConvention();

            b.Property(r => r.Name).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNameLength);
            b.Property(r => r.NormalizedName).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNormalizedNameLength);
            b.Property(r => r.IsDefault).HasColumnName(nameof(IdentityRole.IsDefault));
            b.Property(r => r.IsStatic).HasColumnName(nameof(IdentityRole.IsStatic));
            b.Property(r => r.IsPublic).HasColumnName(nameof(IdentityRole.IsPublic));

            b.HasMany(r => r.Claims).WithOne().HasForeignKey(rc => rc.RoleId).IsRequired();

            b.HasIndex(r => r.NormalizedName);
        });
        
        builder.ConfigureIoTProject();
    }
}

Repository

public class EfCoreDeviceRepository : EfCoreRepository<IoTProjectDbContext, Device, Guid>, IDeviceRepository
{
    public EfCoreDeviceRepository(IDbContextProvider<IoTProjectDbContext> dbContextProvider)
        : base(dbContextProvider)
    {
    }

    public override async Task<IQueryable<Device>> WithDetailsAsync()
    {
        return (await base.WithDetailsAsync()).Include(t => t.Role).Include(t => t.User);
    }

    // ...
}

Hi gexiaoxu, In the latest version, it works normally, your problem may be related to the network.

Showing 11 to 20 of 21 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06