有下面的类,并尝试在数据库中查找记录返回错误.使用C#,MVC 4,Entity Framework 4和SQL Server 2012数据库.
Unable to determine the principal end of an association between the types 'FlexApp.Models.Model.Usuario' and 'FlexApp.Models.Model.Usuario'.
The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
Run Code Online (Sandbox Code Playgroud)
public class Usuario
{
[Key]
public int UsuarioID { get; set; }
public string Nome { get; set; }
public int UsuCad { get; set; }
public int UsuAlt { get; set; }
[ForeignKey("UsuCad")]
public virtual Usuario UsuarioCad …Run Code Online (Sandbox Code Playgroud) 我已经将Azure AD OAuth2守护程序或服务器实现为ASP.NET Web API.但是我只收到一个访问令牌,它是AuthenticationResult上的属性.见下面的实施.
public IHttpActionResult GetAccessToken(string clientId, string clientkey)
{
AuthenticationContext authContext = new AuthenticationContext(authority);
ClientCredential clientCredential = new ClientCredential(clientId, clientkey);
AuthenticationResult authenticationResult = authContext.AcquireTokenAsync(resourceUri, clientCredential).Result;
Authorisation authorisation = new Authorisation {access_token = authenticationResult.AccessToken,
token_type = authenticationResult.AccessTokenType,
expires_on = authenticationResult.ExpiresOn };
return Ok(authorisation);
}
Run Code Online (Sandbox Code Playgroud)
这仅返回访问令牌.我想要一个实现,一个守护进程或服务器实现,它返回访问令牌和刷新令牌.有你看过或做过类似的实现.欢迎任何有用的示例链接.
结构图方法,scan.WithDefaultConventions(); 在structuremap.MVC 5中假定使用约定IMyClassName,MyClassName作为依赖注入.如果您只创建了类,这没关系.
使用开箱即用的ASP.NET MVC 5应用程序,约定IMyClassName,MyClassName不会退出用户身份.如何配置structuremap以忽略ASP.NET Framework接口/类?
structuremap asp.net-mvc dependency-injection ioc-container structuremap3