I'm a new Mongo user (haven't gotten used to the name even... makes me laugh every time), and I have this problem (feeling mongo).
I ha开发者_如何转开发ve a class "User", with the MongoIdentifier defined like this:
[MongoIdentifier]
public string Username { get; set; }
In another class "Role" I have a DbReference
that looks like this:
public DbReference<User> Creator { get; set; }
This compiles well, but when I try to set the Creator like this:
role.Creator = new Norm.BSON.DbTypes.DbReference<User>(userOnline.Username);
I get the following error:
System.FormatException: Could not find any recognizable digits.
Any ideas why?
Thanks
Found a solution... I had to specify the type of the MongoIdentifier:
public DbReference<User, String> Creator { get; set; }
and...
role.Creator = new Norm.BSON.DbTypes.DbReference<User, String>(userOnline.Username);
精彩评论