I work on asp.net core on razor page i face issue i can't call dto classes from appliction layer in shared layer
my web application contain 4 layer
Application(have dto classes)
Core
Host
Shared(place i need to call dto classes)
when i come on shared layer and call dto classes that exist on application layer
not added
i try on shared layer add
using UC.ADC.Application.Asset.Dto;
class i need to call it on shared layer as below
namespace UC.ADC.Application.Asset.Dto
{
public class AssetBranchesItems
{
public string SelectedMCU { get; set; }
public string SelectedMCUName { get; set; }
}
}
on shared layer i can't call dto class above from application layer
namespace UC.ADC.Shared.Assets
{
public class DisplayAssetTaggingDetails
{
public List asstBranchesLists{ get; set; }
}
}
if i try to add on shared layer
UC.ADC.Application.Asset.Dto
not accept add UC.ADC.Application.Asset.Dto
and also when i write on shared layer
public List
not auto complete or detect that class AssetBranchesItems exist on application layer
so what i do to solve this issue
ahmed salahPosted Feb 20, 2024, 8:37 AM
can any one help me please
ahmed salahPosted Feb 20, 2024, 7:15 AM
i shared image as below
my question how to access class dto on application layer inside shared layer
ahmed salahPosted Feb 20, 2024, 7:13 AM
my screen shoot of Shared layer and Application layer as below
Amit MohantyPosted Feb 20, 2024, 7:11 AM
To check reference: Right-click on the Shared project in Visual Studio, select "Add" > "Project Reference..." (ensure that the Application project is listed there) and select the reference project from the list.
ahmed salahPosted Feb 20, 2024, 7:00 AM
how to add reference of application layer inside on shared layer
can you please show me more details
Amit MohantyPosted Feb 20, 2024, 6:44 AM
Ensure that your Shared layer has access to the types defined in the Application layer. Make sure that your Shared project has a reference to the Application project in its dependencies.
In your Shared layer file where you're trying to use the DTO classes, ensure that you have imported the correct namespace. For example:
If still getting error, try cleaning and rebuilding your solution to ensure that everything is up-to-date. Sometimes, build issues can arise due to stale or corrupted build artifacts.