What's in the error log?
That's what I suspected. Try doing:
MyEntityDetails.MyChildEntity = MyChildEntity.ToList();
What's the implementation of CommonAppService.GetLookupItems?
Don't do it in the constructor. You can make it a method.
Make all your projects target netcoreapp2.0 to avoid errors of this form:
"Package '...' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project."
If you can put both appsettings.json and testappsettings.json in the same folder, just follow these 3 steps:
private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null, bool addUserSecrets = false)
{
var builder = new ConfigurationBuilder()
.SetBasePath(path)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
.AddJsonFile("testappsettings.json", optional: true, reloadOnChange: true); // This line
// ...
}
public static IConfigurationRoot GetConfiguration()
{
return SingletonDependency<IAppConfigurationAccessor>.Instance.Configuration; // This line
}
Your original way works. Your original way:
Your original way:
.AddJsonFile(Path.Combine(currentPath, "..", "..", "..", "..", "..", "src", "MyCompany.MyProject.Web.Host", $"appsettings.json"), false);
Get configuration:
IocManager.Register<IAppConfigurationAccessor, TestAppConfigurationAccessor>();
var configuration = IocManager.Resolve<IAppConfigurationAccessor>().Configuration;
Configuration.Modules.AspNetZero().LicenseCode = configuration["AbpZeroLicenseCode"];
The commented section works fine when uncommented but I wonder if there is any way of having the UpdateOwnAsync method instead of the UpdateAsync method on the _jobLocationRepository?
await _jobLocationRepository.UpdateOwnAsync(jobLocation);
The problem is that the IsGrantedAsync() fails and throws exception when no logged in user. So first I need to check if the request is coming from a logged in user or not
It's GetCurrentUser() that throws. GetCurrentUser calls AbpSession.GetUserId(). Read the documentation on Session Properties:
If you're sure there is a current user, you can call GetUserId(). If the current user is null, this method throws an exception.
So just check if AbpSession.UserId is null.