How to change type of id in Microsoft.AspNet.Identity.EntityFramework.IdentityUser
By : udaya
Date : March 29 2020, 07:55 AM
around this issue So if you want int ids, you need to create your own POCO IUser class and implement your IUserStore for your custom IUser class in the 1.0 RTM release. This is something we didn't have time to support, but I'm looking into making this easy(ier) in 1.1 right now. Hopefully something will be available in the nightly builds soon. code :
public class GuidRole : IdentityRole<Guid, GuidUserRole> {
public GuidRole() {
Id = Guid.NewGuid();
}
public GuidRole(string name) : this() { Name = name; }
}
public class GuidUserRole : IdentityUserRole<Guid> { }
public class GuidUserClaim : IdentityUserClaim<Guid> { }
public class GuidUserLogin : IdentityUserLogin<Guid> { }
public class GuidUser : IdentityUser<Guid, GuidUserLogin, GuidUserRole, GuidUserClaim> {
public GuidUser() {
Id = Guid.NewGuid();
}
public GuidUser(string name) : this() { UserName = name; }
}
private class GuidUserContext : IdentityDbContext<GuidUser, GuidRole, Guid, GuidUserLogin, GuidUserRole, GuidUserClaim> { }
private class GuidUserStore : UserStore<GuidUser, GuidRole, Guid, GuidUserLogin, GuidUserRole, GuidUserClaim> {
public GuidUserStore(DbContext context)
: base(context) {
}
}
private class GuidRoleStore : RoleStore<GuidRole, Guid, GuidUserRole> {
public GuidRoleStore(DbContext context)
: base(context) {
}
}
[TestMethod]
public async Task CustomUserGuidKeyTest() {
var manager = new UserManager<GuidUser, Guid>(new GuidUserStore(new GuidUserContext()));
GuidUser[] users = {
new GuidUser() { UserName = "test" },
new GuidUser() { UserName = "test1" },
new GuidUser() { UserName = "test2" },
new GuidUser() { UserName = "test3" }
};
foreach (var user in users) {
UnitTestHelper.IsSuccess(await manager.CreateAsync(user));
}
foreach (var user in users) {
var u = await manager.FindByIdAsync(user.Id);
Assert.IsNotNull(u);
Assert.AreEqual(u.UserName, user.UserName);
}
}
|
An unhandled exception of type 'System.ArgumentNullException' occurred in Microsoft.Xna.Framework.Graphics.dll
By : ccpizzadaisuki
Date : March 29 2020, 07:55 AM
this will help It is because when you create your createMap object, map, the textures (grass, stone, dirt) are null so it populates the array tiles in the map object with null items. Later, when you go to draw them, the 1st param (texture2d) is not allowed to be null so it throws the error. If you try to run the code, it stops at that spriteBatch.Draw line and turns it yellow. Hover your mouse cursor over the tiles[tileID] and under it click the + sign. you will see 3 null textures there. code :
class game
{
public static Texture2d grass;
public createMap map;
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
device = graphics.GraphicsDevice;
background = Content.Load<Texture2D>("plain");
player = Content.Load<Texture2D>("Player_Test");
grass = Content.Load<Texture2D>("grass");
dirt = Content.Load<Texture2D>("dirt");
stone = Content.Load<Texture2D>("stone");
//then create the map
map = new createMap();
}
//rest of class
}
|
Nuget error: 'EntityFramework 5.0.0' is not compatible with 'Microsoft.AspNet.Identity.EntityFramework 1.0.0
By : Steinar Moen
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Asp Identity Entity Framework 2 has dependency to Entity Framework version 6.0.1 and above. See documentation
|
The entity type 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>' requires a key to be defined
By : Stevo
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Basically the keys of Identity tables are mapped in OnModelCreating method of IdentityDbContext and if this method is not called, you will end up getting the error that you got. This method is not called if you derive from IdentityDbContext and provide your own definition of OnModelCreating as you did in your code. With this setup you have to explicitly call the OnModelCreating method of IdentityDbContext using base.OnModelCreating statement. This answer also discusses the option I posted here
|
An exception of type 'System.ArgumentNullException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled i
By : SA MU Ell
Date : March 29 2020, 07:55 AM
I hope this helps . This is just a simple variable naming error :) In your line of code that's causing the exception, you are referencing the variable StorageContainerReference from your Web.config file. However, in your Web.config file, the variable is named CloudStorageContainerReference.
|