0

Using the Entity Framework that I generated. I have a Roles table created during the default system AspNetSqlRoleProvider security set-up.

In the Roles table, I have an ApplicationId uniqueidentifier column. Which has a guid populated in it, which doesn't change for my application.

I need to add a Role manually through my app using the entity framework. However, when creating my Roles object and setting Roles.ApplicationId. It expects a type of Guid. I have the ApplicationId in my web.config app settings. As it shouldn't change. But it is returned at string. I cannot type cast the value either to use in Roles.ApplicationId.

What can I do to use my current ApplicationId value when trying to create a new role manually using the EF?

0

1 Answer 1

1

You're going to have to convert to a Guid, but that's easy to do. The constructor takes a string value that's the GUID form (new Guid("..")), or I think there may be a Parse method too.

HTH.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.