The SQL Data has the following Content:
string Username = admin
string Password = admin
string Email = admin@admin.com
boolean Active = 1
string Permissions = 1;4;7;8;9
The issue here is, that it won't fill my List "Permissions".
In the Database as you see above I have just 1 Field with Semicolon separated values.
All these various values need to be put into the List named Permissions.
The error message I get is the following:
Message = "LINQ to Entities does not recognize the method 'System.String[] Split(Char[])' method, and this method cannot be translated into a store expression."
public class UserData
{
public string Username { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public bool active { get; set; }
public List<string> Permissions { get; set; }
}
var Results = from a in context.UserAdmin
select new UserData
{
Username = a.Username,
Password = a.Password,
Email = a.Email,
Active = a.Active,
Permissions= a.Permissions.Split(';').ToList()
};
I have seen some thread in the internet talking about this, but the solutions did not really fit for me. And I don't want to create an additional query or something like that. I would like to solve this with one or two lines inside this LINQ query if possible.