Base solution for your next web application
Open Closed

RAD tool code generation has a bug #4999


User avatar
0
vladsd created

Last version of RAD tool introduced GetAll with views and serious bug. I file report. Please advise of a solution as it is a show stopper. <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1061">https://github.com/aspnetzero/aspnet-ze ... ssues/1061</a>


9 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    the issue seems to be closed. Has your problem been solved?

  • User Avatar
    0
    vladsd created

    Nop, suggestion in the issue did not solve it. also there is not way to know which version of the RAD tool I am using

  • User Avatar
    0
    vladsd created

    I am using v 5.3 and still has the code which fails if query does not find anything. See

    public async Task<PagedResultDto<GetAll{{Entity_Name_Plural_Here}}Output>> GetAll(GetAll{{Entity_Name_Plural_Here}}Input input)
             {
    			var query = (from o in _{{entity_Name_Here}}Repository.GetAll()
                             {{NP_Looped_Query_Join_Here}}
                             select new GetAll{{Entity_Name_Plural_Here}}Output() { {{Entity_Name_Here}} = ObjectMapper.Map<{{Entity_Name_Here}}Dto>(o)
    						 {{NP_Looped_Map_Join_Here}}
    						 })
    						 .WhereIf(
    							!string.IsNullOrWhiteSpace(input.Filter),
    						    e => false {{Property_Looped_Template_Here}}
    							);
    
                var totalCount = await query.CountAsync();
    
                var {{entity_Name_Plural_Here}} = await query
                    .OrderBy(input.Sorting ?? "{{entity_Name_Here}}.id asc")
                    .PageBy(input)
                    .ToListAsync();
    
                return new PagedResultDto<GetAll{{Entity_Name_Plural_Here}}Output>(
                    totalCount,
                    {{entity_Name_Plural_Here}}
                );
             }
    
  • User Avatar
    0
    yekalkan created

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1061#issuecomment-382485152">https://github.com/aspnetzero/aspnet-ze ... -382485152</a>

  • User Avatar
    0
    vladsd created

    Mystery, I installed v.5.3 and 1.4 rad tool on different computer and generates different code for GetAll.

    As you can see, it creates filter first.

    Both places say that v1.4 installed. I guess VS2017 I have have an issue with caching older version of the tool. You might want to look into it, as I move DLL files into dir, and did update on the tool, insted of reinstalling it.

    public async Task<PagedResultDto<GetMyTestForView>> GetAll(GetAllMyTestsInput input) {

    		var filteredMyTests = _myTestRepository.GetAll()
    					.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false  || e.Name.Contains(input.Filter) || e.Description.Contains(input.Filter))
    					.WhereIf(!string.IsNullOrWhiteSpace(input.NameFilter),  e => e.Name.ToLower() == input.NameFilter.ToLower().Trim())
    					.WhereIf(!string.IsNullOrWhiteSpace(input.DescriptionFilter),  e => e.Description.ToLower() == input.DescriptionFilter.ToLower().Trim());
    
    
    		var query = (from o in filteredMyTests
                         
                         select new GetMyTestForView() { MyTest = ObjectMapper.Map&lt;MyTestDto&gt;(o)
    					 
    					 })
    					 ;
    
            var totalCount = await query.CountAsync();
    
            var myTests = await query
                .OrderBy(input.Sorting ?? "myTest.id asc")
                .PageBy(input)
                .ToListAsync();
    
            return new PagedResultDto&lt;GetMyTestForView&gt;(
                totalCount,
                myTests
            );
         }
    
  • User Avatar
    0
    vladsd created

    Yes, I figured that I did not update templates. I dd a full folder copy for RAD tool but some reason it did not come through. Consider putting those templates under version control so changes can be tracked.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @vladsd currentlye source code of RAD Tool is closed. When you update Visual Studio extension, templates must be updated as well.

  • User Avatar
    0
    vladsd created

    @ ismcagdas - I was thinking just source control templates, not the code generation part. Thanks for your support.

  • User Avatar
    0
    alper created
    Support Team

    yeah might be good idea ;)