MySQL Forums :: MySQL for Visual Studio :: MySql - Simple Membership Provider (VS 2015)

Advanced Search

MySql - Simple Membership Provider (VS 2015)
Posted by: Massimo Mondino ()
Date: October 31, 2016 01:34AM

I'm working on a project in Visual Studio 2015 with Entity Framework. I'm now trying to configure Simple Membership Provider for working with my user table. I have already followed this tutorial:
to setup the application.

Some info:
- my User table in the designer:

<EntityType Name="Users">
<PropertyRef Name="Id" />
<PropertyRef Name="SoftwareVersion" />
<Property Name="Name" Type="varchar" Nullable="false" MaxLength="40" />
<Property Name="Role" Type="longtext" Nullable="false" />
<Property Name="Email" Type="longtext" Nullable="false" />
<Property Name="Group" Type="longtext" Nullable="false" />
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="SoftwareVersion" Type="smallint" Nullable="false" />

- My User class:

public partial class User
public User()
this.dfcs = new HashSet<Dfc>();
this.fids = new HashSet<Fid>();
this.histroyDeliverRequests = new HashSet<Histroyrequest>();
this.histroyProposalRequests1 = new HashSet<Histroyrequest>();

public string Name { get; set; }
public string Role { get; set; }
public string Email { get; set; }
public string Group { get; set; }
public int Id { get; set; }
public short SoftwareVersion { get; set; }

public virtual ICollection<Dfc> dfcs { get; set; }
public virtual ICollection<Fid> fids { get; set; }
public virtual ICollection<Histroyrequest> histroyDeliverRequests { get; set; }
public virtual ICollection<Histroyrequest> histroyProposalRequests1 { get; set; }
public virtual Software Software { get; set; }

- the InitialieDatabaseConnection method:

MySql.Web.Security.MySqlWebSecurity.InitializeDatabaseConnection("MySqlSimpleMembership", "Users", "Id", "Name", true);

The problem is: when I try to register a new user (for example a Super Administrator) I got an exception on that code:

1 -
MySql.Web.Security.MySqlWebSecurity.CreateUserAndAccount("Super Administrator", "admin", additionalUserAttributes: new
Role = "Super Administrator",
Email = "",
Group = "Super Administrator",
Id = 0,
SoftwareVersion = 1


"Parameter index is out of range"

2 -
MySql.Web.Security.MySqlWebSecurity.CreateUserAndAccount("Super Administrator", "admin", additionalUserAttributes: new
//Role = "Super Administrator",
//Email = "",
//roup = "Super Administrator",
//Id = 0,
SoftwareVersion = '1'

"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1) values('Super Administrator',_binary 'System.Object[]')' at line 1"

3 -

MySql.Web.Security.MySqlWebSecurity.CreateUserAndAccount("Super Administrator", "admin");


"Cannot add or update a child row: a foreign key constraint fails (`rcm`.`users`, CONSTRAINT `FK_UserSoftware` FOREIGN KEY (`SoftwareVersion`) REFERENCES `softwares` (`Version`) ON DELETE NO ACTION ON UPDATE NO ACTION)
That error is ok. Foreign key constraint fails (but this show me at least it is working on my user table)."

That error is ok. Foreign key constraint fails (but this show me at least it is working on my user table).

Any suggestions about those problems? Seems a SQL syntax problem but I can't control it since I'm using a framework that write the SQL code for me. Maybe I'm missing something...

Options: ReplyQuote

Subject Views Written By Posted
MySql - Simple Membership Provider (VS 2015) 585 Massimo Mondino 10/31/2016 01:34AM
Re: MySql - Simple Membership Provider (VS 2015) 264 Javier TreviƱo 11/04/2016 10:56AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.