我有一个有趣的问题,我需要以特定的方式舍入AVG()函数的结果,以便在ORDER BY子句中使用.
这些用于配方评级.
舍入公式的示例:
1.2 -> 1
1.4 -> 1
1.5 -> 1.5
1.6 -> 2
1.9 - >2
Run Code Online (Sandbox Code Playgroud)
我正在查询食谱清单,他们需要订购,以便订购一个五星评级的配方不会在100个评级平均4.9的配方上面订购.order by子句的第二部分是评级计数.
如果这需要用户定义的功能,我不太清楚如何去做.
我正试图在导航到ViewModel时将服务注入.尽管我已经看过Brian Lagunas的博客,示例代码等,但有些东西似乎不对.
在我的App.cs中给出
public class App : PrismApplication
{
protected override void OnInitialized ()
{
NavigationService.NavigateAsync ("SignInPage", animated: false);
}
protected override void RegisterTypes ()
{
Container.RegisterTypeForNavigation<SignInPage>();
Container.RegisterType<IUserAuthentication, UserAuthenticationService>();
}
Run Code Online (Sandbox Code Playgroud)
}
注意:usingIUserAuthentication和UserAuthenticationService命名空间的语句已到位.
SignInPageViewModel.cs
private INavigationService _navigationService;
private IUserAuthentication _userAuthenticationService;
public SignInPageViewModel(INavigationService navigationService, IUserAuthentication userAuthenticationService)
{
_navigationService = navigationService;
_userAuthenticationService = userAuthenticationService;
}
Run Code Online (Sandbox Code Playgroud)
Container.RegisterType似乎不接受通用.我在Unity中看到的所有示例似乎都支持它,但是我收到以下错误.
The non-generic method 'IUnityContainer.RegisterType(Type, Type, string, LifetimeManager, params InjectionMember[])' cannot be used with type arguments
Run Code Online (Sandbox Code Playgroud)
这是一个构建错误.
包装信息