Base solution for your next web application

Activities of "cicciottino"

  1. is there a way to get more details from an error happened in the repository layer ( for example getting the "inner excption") have i replace the .dll with the source code? or is there a way to expose more datails about the error? a i'm trying to add a "task" but i got a popoup(a javascript alert) whit the message: "An internal error occured during your request!" so i don't know how to investigate.

  2. i made some modifications on the model, later i've applyed some migrations to the db. i don't know what is the correct way to regenerate the db from the beginning and resync the migration: i did this:

  3. delete all the migration class

  4. removed the db

  5. add-migration "myFirstMigration"

  6. UpdateDatabase

i know this is not related with your awesome project, but can you tell me something about this second question as well? thanks a lot

i'm completely fall in love with your project and i'd like to learn a lot about it forgive me for my english.

i'm trying to ad a new entity to the SimpleTaskSystem example project

in order to add a "car" entity and everything it needs to be displayed i did exactly this till now:

  1. create the "car" entity
  2. create the a new repositoty for the new entity
  3. create the ApplicationLayer a dn relative DTOs + input/output objects
  4. create views and relative angulars'controller file

at this poin i got this error into the browser consolle:

Error: [$injector:unpr] http://errors.angularjs.org/1.3.8/$injector/unpr?p0=abp.services.tasksystem.carProvider%20%3C-%20abp.services.tasksystem.car%20%3C-%20sts.views.car.list
   at Anonymous function (http://localhost:6247/Scripts/angular.min.js:38:301)

i suppose the problem is the name of the angular services that i used in my angular controller (in my case 'abp.services.tasksystem.car') the question is:

  • is this angular service autogenerated?
  • is the naming convention (that i used) correct supposing that i have an ApplicationLayer that is named "CarAppServices" and has a method named "GetFreeCarsOutput"
  • did i miss something after the point "4"? did i have to add something else other than view and controller?

THE APPLICATION LAYER

public class CarAppServices : ApplicationService, ICarAppServices
    {
        private readonly ICarRepository _carRepository;
        private readonly IRepository<Person> _personRepository;

        public CarAppServices(ICarRepository carRepository, IRepository<Person> personRepository)
        { 
            _carRepository = carRepository;
            _personRepository = personRepository;
        }

        public GetFreeCarsOutput GetFreeCars(GetFreeCarsInput input)
        {
            var cars = _carRepository.GetAllFreeCars(input.MaxSpeed);
            return new GetFreeCarsOutput
            {
                Cars = Mapper.Map<List<CarDto>>(cars)
            };
        }
    }

THE ANGULAR CONTROLLER

(function() {
    var app = angular.module('app');

    var controllerId = 'sts.views.car.list';
    app.controller(controllerId, [
        '$scope', 'abp.services.tasksystem.car',
        function($scope, carService) {
            var vm = this;
	    .....
            ....
            ...
            ..
            .
		
	    var myCars = carService.getAllFreeCars({
	    .....
            ....
            ...
            ..
            .

arent't sweetalert needed files included in the taskSystem sample project? i can download them (css and js) from the sweetalert's site but where is the abp.sweet-alert.js file?

than, should i add the abp.sweet-alert.js file to the layout.cshtml? and in what folder i have to put the css and js file in the TaskSystem project?

thanks

what is the best practice about the response to confirm the deletion?

i saw in the taskever live esample:

taskever/src/Taskever.Application/Tasks/TaskAppService.cs

public DeleteTaskOutput DeleteTask(DeleteTaskInput input) 
         { 
             var task = _taskRepository.FirstOrDefault(input.Id); 
             if (task == null) 
             { 
                 throw new Exception("Can not found the task!"); 
             } 
 
 
             var currentUser = _userRepository.Load(AbpUser.CurrentUserId.Value); 
             if (!_taskPolicy.CanDeleteTask(currentUser, task)) 
             { 
                 throw new UserFriendlyException("You can not delete this task!"); 
             } 
 
 
             _taskRepository.Delete(task); 
 
 
             return new DeleteTaskOutput();  //<------------is mapping missing????? or is automatic?
         }

id the "DeleteTaskOutput" not mapped?, the json output is always "zero"

{"success":true,"result":{"id":0},"error":null,"unAuthorizedRequest":false}

and anyway this contains only the entity's id, is it better to serve the entire entity to output or the only id is enough?(is there a best practice for the Delete operation?)

Then how can i remove the deleted entity from the angular collection?(in the case i return the only id, or the entire entity in the json)

taskService.deleteTask({
                    id: document.id
                }).success(function(value) {
                    
                    var index = vm.task.indexOf(value.id);  //<-- it doesn't work, does it expect the entire entity instead of the "id"?
                    vm.tasks.splice(index, 1);
                    
                });

thanks a lot

i'm trying to install module zero from scratch

i've followed the documentation: <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Zero/installation#DocInstallManual">http://aspnetboilerplate.com/Pages/Docu ... tallManual</a>

till this point... i can't see this method

internal sealed class Configuration : DbMigrationsConfiguration<AbpZeroSample.EntityFramework.AbpZeroSampleDbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;
        ContextKey = "AbpZeroSample";
    }

    protected override void Seed(AbpZeroSample.EntityFramework.AbpZeroSampleDbContext context)
    {
        context.DisableAllFilters();   //<--- it seems not existing ????
        new DefaultTenantRoleAndUserBuilder(context).Build();
    }
}

xxx.DisableAllFilters(); where is implemented?

"AbpZeroSampleDbContext" implements "AbpZeroDbContext" where i supposed to found the method (or in its own derivated classes)

Question

i'm trying to install ModuleZero from scrath following the link: <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Zero/installation#DocInstallManual">http://aspnetboilerplate.com/Pages/Docu ... tallManual</a>

in the Login(POST)method of AccountController i got an error

[HttpPost]
        public async Task<JsonResult> Login(LoginViewModel loginModel, string returnUrl = "")
        {
            if (!ModelState.IsValid)
            {
                throw new UserFriendlyException("Your form is invalid!");
            }
								                                        //=================================
            var loginResult = await _userManager.LoginAsync(    //<--HERE IS WHERE I GOT THE ERROR
                loginModel.UsernameOrEmailAddress,              //=================================
                loginModel.Password,
                loginModel.TenancyName
                );

            switch (loginResult.Result)
            {
                case AbpLoginResultType.Success:
                    break;
                case AbpLoginResultType.InvalidUserNameOrEmailAddress:
                case AbpLoginResultType.InvalidPassword:
                    throw new UserFriendlyException("Invalid user name or password!");
                case AbpLoginResultType.InvalidTenancyName:
                    throw new UserFriendlyException("No tenant with name: " + loginModel.TenancyName);
                case AbpLoginResultType.TenantIsNotActive:
                    throw new UserFriendlyException("Tenant is not active: " + loginModel.TenancyName);
                case AbpLoginResultType.UserIsNotActive:
                    throw new UserFriendlyException("User is not active: " + loginModel.UsernameOrEmailAddress);
                case AbpLoginResultType.UserEmailIsNotConfirmed:
                    throw new UserFriendlyException("Your email address is not confirmed!");
                default: //Can not fall to default for now. But other result types can be added in the future and we may forget to handle it
                    throw new UserFriendlyException("Unknown problem with login: " + loginResult.Result);
            }

            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
            AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = loginModel.RememberMe }, loginResult.Identity);

            if (string.IsNullOrWhiteSpace(returnUrl))
            {
                returnUrl = Request.ApplicationPath;
            }

            return Json(new MvcAjaxResponse { TargetUrl = returnUrl });
        }

the error is only visible with the browser tool(F12-->network)

Multiple object sets per type are not supported. The object sets 'Roles' and 'Roles' can both contain instances of type 'ModuleZeroFromScratch.Authorization.Roles.Role'

so (as you suggest me in the past) i placed the class

public class MyExceptionHandler : IEventHandler<AbpHandledExceptionData>, ITransientDependency
    {
        public void HandleEvent(AbpHandledExceptionData eventData)
        {
            //TODO: Check eventData.Exception!
        }
    }

into the web project but nothing. Again, i put this class in the "Core" module (where the source of error is, "UserManager") but nothing.

the questions are:

  1. putting this class in the Web project(the outermost) does it catch exceptions occurred in every module? or only in the module where such a class is present? If it is the first why this does not happen?

  2. do you have an idea from the message what is the problem or at least what i should check?

is it possible to pass a normal string istead of a LocalizableString into the "DisplayName" parameter of the (MenuItemDefinition)NavigationProvider? if not, is there a sort of workaround?

public override void SetNavigation(INavigationProviderContext context)
{
context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        "Home",
                        new LocalizableString("HomePage", AbpZeroSampleConsts.LocalizationSourceName),
                        url: "#/",
                        icon: "fa fa-home"
                        )
                ).AddItem(
                    new MenuItemDefinition(
                        "About",
                        new LocalizableString("PoisList", AbpZeroSampleConsts.LocalizationSourceName),  //using a normal string instead of LocalizationString
                        url: "#/About",
                        icon: "fa fa-info"
                        );

applying some ".where(x=>....)" condition in the repository the filter is not applied (i verified this with the sqlprofiler as well)

my ApplicationService (PoiAppService):

public class PoiAppService : ApplicationService, IPoiAppService
    {
        private readonly IPoiRepository _poiRepository;
        
        public PoiAppService(IPoiRepository poiRepository)
        {
            _poiRepository = poiRepository;
        }


        public GetPoisOutput GetPois(GetPoisInput input)
        {
            var pois = _poiRepository.GetAllPois(input.State, null);

            return new GetPoisOutput
            {
                Pois = Mapper.Map<List<PoiDto>>(pois)
            };
        }
    }
}

my repository (PoiRepository)

public class PoiRepository : AbpZeroSampleRepositoryBase<Poi,long>, IPoiRepository
    {
        public PoiRepository(IDbContextProvider<AbpZeroSampleDbContext> dbContextProvider)
            : base(dbContextProvider)
        { 
        }


        public List<Poi> GetAllPois(PoiState poistate, PoiType poitype)   //PoiType is not used yet
        {
            var query = GetAll();

            if (poistate == PoiState.NotVerified)
                query.Where(x => x.ValidationRate == 0);      //<--this seems not applied
            if (poistate == PoiState.Verified)
                query.Where(x => x.ValidationRate > 0);	      //<--this seems not applied

            return query.OrderByDescending(x => x.Name).ToList(); 
        }

    }

debugging the code i've noticed that the execution of both (applicationService method and repository method) happens twice. And i've verified with the browser tool that the call to the service happened once! why? the execution passes two times in the same code? anyway the .where condition on the query is never applied (as sqlprofiles has showed me)

How to pass parametrs from a view that contains a list of items to a view used for edit that item? Simply passing the id of the entity on a link href? or using some javascript api exposed from "abp", or using something more structured like passing data while you activete a paticular "state" of the Angular UI routing component? Can you indicate me some "best practice" that you are used to adopt? Is there an example in your example project? in the "Simple Task Application" project i haven't found anything about it, can you give me a clue?

thanks a lot.

does exist in the framework a javascript function to create objects(javascript dto objects) based on the serviceLayer (dto/dtoInput)

var newPerson = {
    name: 'Dougles Adams',
    age: 42
};

abp.ajax({
    url: '/People/SavePerson',
    data: JSON.stringify(newPerson)
}).done(function(data) {
    abp.notify.success('created new person with id = ' + data.personId);
});

something that creates for me a "newPerson" based on the structure that i've defined in my dto?

Showing 1 to 10 of 18 entries