找到你要的答案

Q:Could really use some direction with this simple project that is using Identity

Q:真的可以使用这个简单的项目,使用身份的一些方向

I've been working on this after work for the past three days, and sometimes I feel like I'm figuring it out, but then I'm not really sure.

It's a really simple EF setup:

A MyUser class that extends IdentityUser and the only property of that is a public virtual ICollection<Message> Messages { get; set; }

Then the Messages class that has an ID, Text, and virtual MyUser property.

https://github.com/shmup/tomahawk/blob/master/Tomahawk/Models/TomahawkModel.cs

I've also generated a controller for Messages.

The error happens right when trying to manager.FindById(User.Identity.GetUserId()) and says Invalid object name 'dbo.Users' http://i.imgur.com/VFshstd.png

It does have the User.Identity.GetUserId(), though.

Specifically:

https://github.com/shmup/tomahawk/blob/master/Tomahawk/Controllers/MessagesController.cs#L31

Not too many hours ago I recall the problem being that I could see (while debugging on an error) that it had my Identity user, shown authorized, but it was returning null with the UserManager, not able to find the user by ID. I looked in my DB and saw a single Message was inserted, UserId being null, but couldn't find out where the users were even being stored.

I feel like you do when you've read the same word dozens of times and then it starts to looks funny, because I've Googled and Googled and Googled and read some asp blog posts and, well, here I am asking for any guidance at all.

I am required to use: "C#, MVC, User Accounts, and EF". I wonder if I should have even bothered with IdentityUser.

在过去的三天里,我一直在工作,有时我觉得我在想出来,但我不太确定。

这是一个非常简单的EF设置:

一类扩展中identityuser和唯一的财产就是一个公共的虚拟ICollection <;消息>;信息集;} {得到;

然后消息类,有一个ID,文字,和虚拟中的财产。

https://github.com/shmup/tomahawk/blob/master/tomahawk/models/tomahawkmodel.cs

我还为消息生成了一个控制器。

The error happens right when trying to manager.FindById(User.Identity.GetUserId()) and says Invalid object name 'dbo.Users' http://i.imgur.com/VFshstd.png

它有用户的身份。getuserid(),虽然。

明确地:

http:/ / GitHub。COM / shmup /战斧/斑点/硕士/托马霍克/控制器/ messagescontroller CS # L31。

没有太多的时间前,我记得,我看到的问题(在一个错误的调试),里面有我的身份的用户,所示的授权,但它返回null的UserManager,不能通过ID。我看着我的分贝,看到一个消息被插入到用户,用户名为空,但无法找出用户甚至被存储。

我觉得你做的时候你已经读遍相同的数十道然后开始看起来很滑稽,因为我googled搜索Google搜索和阅读一些ASP博客,嗯,我在这里向所有指导。

我需要用:“C #,MVC,用户帐户,和EF”。我不知道我是否应该有更喜欢IdentityUser。

.net  entity-framework