Base solution for your next web application
Open Closed

Rad 1.3 - navigation property Issue #4852


User avatar
0
faisalalam created

We created a namespace "LookupData" and added two class LookupDataCategory.cs

Name LookupData.Cs Name FK.LookupDataCategoryID Under the same namespace lookup data, it does not work and can't recognize LookupData namespace or navigation property link seems bad.

{{Enum_Using_Looped_Template_Here}}

{{NP_Using_Looped_Template_Here}} using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Abp.Domain.Entities.Auditing; using Abp.Domain.Entities;

namespace {{Namespace_Here}}.{{Namespace_Relative_Full_Here}} { [Table("{{Table_Name_Here}}")] public class {{Entity_Name_Here}} : {{Base_Class_Here}}{{Primary_Key_Inside_Tag_Here}} {{May_Or_Must_Tenant_Here}} { {{Tenant_Id_Here}}

{{Property_Looped_Template_Here}} {{Navigation_Property_Looped_Template_Here}} } } Please review

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

7 Answer(s)
  • User Avatar
    0
    faisalalam created

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/AspNetZeroRadTool/FileTemplates/Server/EntityClass/PartialTemplates.txt">https://github.com/aspnetzero/aspnet-ze ... plates.txt</a>

    "navigationPropertyTemplates":[ { "placeholder" : "{{Navigation_Property_Looped_Template_Here}}", "templates" : [ { "relation" : "single", "content" : " public virtual {{NP_Id_Type_Here}}{{NP_Nullable_Here}} {{NP_Name_Here}} { get; set; } <span style="color:#FF0000">public {{NP_Foreign_Entity_Name_Here}} {{NP_Object_Name_Here}} { get; set; }</span> " } ] },

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    yekalkan created

    @raasforce Did you create both those entities using rad tool? Can you share them?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    faisalalam created

    Yap I will share.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    faisalalam created

    we created 2 classes - basic classes country and state. Please see the errors. Your support system does allow upload document or image. I have to upload twitter and share link.

    [https://pbs.twimg.com/media/DYPTMOBVAAAB-iC.jpg])

    [https://pbs.twimg.com/media/DYPVCK9VAAA8f2N.jpg])

    [url]https://pbs.twimg.com/media/DYPTMOBU8AACXHS.png

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    faisalalam created

    [https://pbs.twimg.com/media/DYPTMOBU8AACXHS.png])

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    faisalalam created

    <span style="color:#FF0000">using Test.LookUp.Country;</span>

    using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Abp.Domain.Entities.Auditing; using Abp.Domain.Entities;

    namespace Test.LookUp.State { [Table("States")] public class State : Entity , IMayHaveTenant { public int? TenantId { get; set; }

    	[Required]
    	[StringLength(StateConsts.MaxNameLength, MinimumLength = StateConsts.MinNameLength)]
    	public virtual string Name { get; set; }
    	
    	[StringLength(StateConsts.MaxCodeNameLength, MinimumLength = StateConsts.MinCodeNameLength)]
    	public virtual string CodeName { get; set; }
    	
    
    	public virtual int? CountryId { get; set; }
    	&lt;span style=&quot;color:#FF0000&quot;&gt;public Country Country { get; set; }&lt;/span&gt;
    	
    }
    

    }

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    yekalkan created

    Namespace and class name are equal, therefore vs says 'you are using a namespace like a type'. This is a rare and usually unwanted case but we'll try to solve it.

    Solution for you:

    • use 'Country.Country' instead of 'Country'.

    You can place the entities in 'LookUp' namespace. Or re-name the namespaces as plural (LookUp.States, LookUp.Countries).

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)