Base solution for your next web application

Activities of "mikemey01"

Nevermind - I figured it out. For anyone else that comes across this, this is what my custom repository looks like in order to get access to the DbContext:

public class PMRenderLeaseAgreementRepository : PropertyMentsRepositoryBase<PMRenderLeaseAgreement>, IPMRenderLeaseAgreementRepository
    {

        public PMRenderLeaseAgreementRepository(IDbContextProvider<PropertyMentsDbContext> dbContextProvider) : base(dbContextProvider)
        {

        }

        public void ExecuteStoredProcedure(string query, params object[] parameters)
        {
            Context.Database.ExecuteSqlCommand(query, parameters);
        }
    }

Also, follow the ABP documentation to put the interface in the .Core project so you can inject it in any of the services. I put the repository class in the EntityFrameworkCore project.

I'm having issues executing a stored procedure that does not return any data. I created a custom repository, but the dbcontext is always null and I'm not sure why.

I read this thread but it doesn't show interaction with the dbcontext: #3345@0db48d15-e4b1-451c-a96b-5b92e3a173c1

Attached is my custom repository and the error that i'm getting. How can I execute a stored procedure?

I got this working where I can now include the AbpUsers table for any AuditedEntity by adding a FK to either CreatorUserId, DeleterUserId, or LastModifierUserId.

Table with CreatorUserId, note that it references Authorization.Users.User instead of subclassing the AbpUsers entity:

[Table("PMNotes")]
    public class PMNotes : FullAuditedEntity, IMustHaveTenant
    {
        public virtual int TenantId { get; set; }
        
         ...

        [ForeignKey("CreatorUserId")]
        public Authorization.Users.User CreatorUser { get; set; }
    }

Added the collection to the Authorization.Users.User table:

public class User : AbpUser<User>
    {
        public ICollection<PMNotes> CreatorNotes { get; set; }
        ...
     }

Then in the DBContext, add the following (although this may not actually be required with the "ForeignKey" attribute above:

modelBuilder.Entity<PMNotes>()
                        .HasOne(m => m.CreatorUser)
                        .WithMany(t => t.CreatorNotes)
                        .HasForeignKey(m => m.CreatorUserId)
                        .OnDelete(DeleteBehavior.Restrict);

Hope it helps someone.

That breaks the app service:

private readonly IRepository<PMNotes> _notesRepository;

with the error:

The type ...PMNotes can not be used as a type parameter 'TEntity' in the generic type or method IRepository<TEntity>.

what is the manual configuration look like?

Hi - I would like to use the same cshtml file to add and edit items. I can create the empty modal no problem but what about passing @Model values to the modal when editing? I don't quite understand how to pass variables/objects to the closure function either directly or using the modalmanager.

Is there an example of how this is done?

Thanks,

Mike

Hi - unfortunately not, I get the following error:

Unable to determine the relationship represented by navigation property 'User.DeleterUser' of type 'User'. Either manually configure the relationship, or ignore this property from the model.

For reference here is what I'm using:

I'm subclassing AbpUsers<User> and using the InverseProperty attribute:

public class User : AbpUser<User>
    {
        [InverseProperty("CreatorUser")]
        public ICollection<PMNotes> CreatorNotes { get; set; }
        [InverseProperty("DeleterUser")]
        public ICollection<PMNotes> DeleterNotes { get; set; }
        
    }

then in the table that I want to reference I'm doing:

[Table("PMNotes")]
    public class PMNotes : FullAuditedEntity, IMustHaveTenant
    {
        public virtual int TenantId { get; set; }

        public virtual User CreatorUser { get; set; }
        public virtual User DeleterUser { get; set; }
        
        [Required]
        public virtual string Note { get; set; }
    }

but i get this error:

Unable to determine the relationship represented by navigation property 'User.DeleterUser' of type 'User'. Either manually configure the relationship, or ignore this property from the model.

Hi - I'm using .net Core/Jquery v4.0

I have an entity that inherits FullAuditedEntity, meaning the CreatorUserID exists on this entity/table. How do I include the AbpUsers table when pulling data from the repository? Since the CreatorUserID column is not setup as a foreign key to the AbpUsers.Id I'm not sure how to reference it correctly. I'm trying to pull in the username from the AbpUsers table into my entity.

Thanks,

Mike

Please ignore - this fixed it:

#2293@9ffc4296-7fbc-4024-a143-0c9b2d107e2c

Hi - I'm using .NET Core MVC / jQuery v4.0.

When I publish to Azure the chat functionality breaks. It works great on my local environment. I enabled websockets on Azure but that did not seem to help. Is there anything else that I can in Azure?

I created a test user account for you to login and take a look, I sent that to <a href="mailto:[email protected]">[email protected]</a> but they told me to post here. Let me know if you want me to send the login credentials to some other address.

Thanks,

Mike

Showing 1 to 10 of 25 entries