Base solution for your next web application

Activities of "winson"

ok, I have solved this issue, because I didn't use the zero-module, so the framework can't get the user id from abpsession, after I review the source code, I know just need to override SetCreationAuditProperties this method and can solve my problem....

anyone can help?

thanks!!!!

Yes, after I used the Repository and it's working, below is my entity, there is no any especially:

public class FormLayout : Entity, IModificationAudited, ICreationAudited
{
    public virtual bool Active { get; set; }

    [Required]
    public virtual int CateTabId { get; set; }

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

    [Required]
    public virtual string Value { get; set; }

    public DateTime CreationTime { get; set; }        

    public DateTime? LastModificationTime { get; set; }

    public long? LastModifierUserId { get; set; }

    public long? CreatorUserId { get; set; }

    [ForeignKey("CreatorUserId")]
    public virtual AdminUser CreatorUser { get; set; }

    [ForeignKey("LastModifierUserId")]
    public virtual AdminUser LastModifierUser { get; set; }

    [ForeignKey("CateTabId")]
    public virtual CategoryTab CateTab { get; set; }
}

I found that if I use a repository to inject the app service, and it's working:

private readonly IFormLayoutRepository _formLayoutRepository;

        public FormLayoutAppService(IFormLayoutRepository formLayoutRepository)
        {
            _formLayoutRepository = formLayoutRepository;
        }

but why it must be use Repository? I have no other custom method to use, so if I create the Repository for each table, these Repositories are empty, and I have to create an interface and implements it, but I just want to use the simple generic methods:

IRepository<MyModel>

Yes, that strange, when I create a new table and controller, I got the error again, don't know why :(

I got the below errors:

Server Error in '/' Application.

Can't create component 'MPeLife.FormLayoutApp.FormLayoutAppService' as it has dependencies to be satisfied.

'MPeLife.FormLayoutApp.FormLayoutAppService' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`1[[MPeLife.Models.FormLayout, MPeLife.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

in my controller:

private readonly IFormLayoutAppService _formLayoutAppService;

public FormLayoutController(IFormLayoutAppService formLayoutAppService)
{
       _formLayoutAppService = formLayoutAppService;
}

in app service:

private readonly IRepository&lt;FormLayout&gt; _formLayoutRepository;

public FormLayoutAppService(IRepository&lt;FormLayout&gt; formLayoutRepository)
{
     _formLayoutRepository = formLayoutRepository;
}

I didn't change any things, just create the new table:(

yes, actually I tried everything before, but still not working, but when I reset the DB and run update-database again, that's working, maybe I use the difference table name between entity and database, but suppose that's not be an issue, I have set the table attribute in the entity model

ok, I have resolved my problem, it's spend me a whole day, it maybe because my entity model name is not same with the database table name, when I drop the table and run update-database again, the problem is solved :(

Showing 11 to 17 of 17 entries