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.

thanks a lot, it goes like a rocket :-)

only a question for didactic purpose..

the exception caught from this class(in my case) indicates that:

Source = "Abp.Web.Api"
Message = "MSDTC sul server 'OLSAITNB-01' non è disponibile."

the problem is clear: the MSDTC on my machine was Disabled (Distributed Coordinator Transaction Services) ,so i enabled it and evertihing worked

but, what is not clear for me is the source of the exception...

i supposed that, if a problem was generated from something related to the "transaction", the exception should be generated from the "Data" layer (the repository for example, or at least, in the "application layer" where the UnitOfWok is managed, is it right?), <ins>anyway not from a "Adp.Web.Api" layer</ins>. can it be that the source indicated in the "source property" is not so accurate and is referred to the outer layer? or, i'm not understanding how it works?

i aspected that the source of the exception was different

i hope to have been clear enough to express my doubt.

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

  1. downloaded the latest version of the project (SimpleTask)
  2. changed the connectionstring to a new empty database
  3. "Play" on visualstudio

got this javascript error :

Unhandled exception at line 105, column 5 in
http://localhost:6247/Abp/Framework/scripts/libs/abp.sweet-alert.js

0x800a138f - Errore di run-time di JavaScript: Impossibile recuperare la proprietà 'on' di un riferimento nullo o non definito

sorry for the italian message bu i think is comprehensible

Are you working on SimpleTaskSystem? -----> YES

Did you create database using Update-Database command? -----> NO, it was beenautomatically generated on the application startup

Probably tou're getting another exception. See Logs folder in web project.

it doesn't seem to show "ERROR" level labels, only "DEBUG" and "INFO" into the log file. anyway the messages as well seems to be only idication of successfully task.

was it important that the database should be generated manually by me with Database-Update command? is it mandatory?

the same error even if i genereate the database with Update-Database...

i downloaded the project after you moved abp.sweet-alert.js to bundle (on github)

PS: On the Durandal Projet everything works, on the Angular one got this

yep, it was cache browser fault :-/ 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 did so, but i don't like

in the application layer

public DeleteDocumentOutput DeleteDocument(DeleteDocumentInput input)
        { 
            var document = _documentRepository.FirstOrDefault(input.Id); 
            if (document == null) 
             { 
                throw new Exception("Can not found the document!"); 
             } 

 
            _documentRepository.Delete(document);

            return new DeleteDocumentOutput 
            {
                Id = document.Id   //<----
            }; 
        }

in the angular controller

documentService.deleteDocument({
                    id: document.id
                }).success(function(value) {
                    

                    vm.documents.forEach(function (element, index, array) {
                        if (element.id === value.id) {
                            vm.documents.splice(index,1);
                        }
                    });

                    vm.refreshDocuments();
		});

could i do it better?

Showing 1 to 10 of 42 entries