我有这两个嵌套的ViewModels:
public class FirstViewModel
{
public SecondViewModel SecondViewModel { get; set; }
}
public class SecondViewModel
{
[Range(1, 12)]
public int month { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
如果我放置month = 13;
然后调用ModelState.IsValid
(在控制器中),验证总是如此true
.
编辑:
这是控制器:
public ActionResult Create()
{
return PartialView(new FirstViewModel);
}
public HttpStatusCodeResult Create (FirstViewModel viewModel){
viewModel.SecondViewModel = new SecondViewModel();
viewModel.SecondViewModel.month = 13;
if (ModelState.IsValid)
{
return new HttpStatusCodeResult(200);
}
else
{
return new HttpStatusCodeResult(304);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在对问题进行抽象,这些不是真正的变量.
When we create a user in Active Directory using Graph API, some characters are appended to the username (#EXT#). This makes impossible to edit the user in AD B2C's interface (documented problem) or doing sign-in using ADAL 2.23 (Active Directory Authentication Library).
Particularly, there's an error (unknown_user_type
) when we use AcquireToken(username, password)
method. The error is the following:
为什么会这样?是否有针对此问题的任何解决方案或解决方法?
问候。
azure azure-active-directory azure-ad-graph-api azure-ad-b2c
在gem中创建生成器时遇到问题.当我运行rails g
发电机时显示:
Supportator:
supportator:initializer
Run Code Online (Sandbox Code Playgroud)
但是当我运行发生器rails generate supportator:initializer
时发生以下错误:
Could not find generator supportator:initializer.
Run Code Online (Sandbox Code Playgroud)
这是生成器的代码:
require 'rails/generators'
module Supportator
class InitializerGenerator < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
def create_initializer_file
copy_file '_browser_validator.html.haml', 'app/views/_browser_validator.html.haml'
copy_file 'en_supportator.yml' , 'config/locales/en_supportator.yml'
copy_file 'es_supportator.yml' , 'config/locales/es_supportator.yml'
end
end
end
Run Code Online (Sandbox Code Playgroud)
这是引擎的代码:
module Supportator
require 'rails'
class Engine < ::Rails::Engine
end
end
Run Code Online (Sandbox Code Playgroud)
你知道为什么会这样吗?