Questions tagged as 'entity-framework'

1
answer

How NOT to cascade records with 1-n relationship using Entity Framework?

I have a table Menu which can have many Categories and these Categories can only have a Menu : public class Menu { public int Id { get; set; } public string Name { get; set; } public virtual ICollection&l...
asked by 20.08.2015 / 20:07
2
answers

Error saving a relationship Many-To-Many [closed]

Following the templates this question , I'm having problems trying to save the data (keys of each of the records) in the table created to make the data relationship. Here's the post method I built: Controller [HttpPost, ValidateAntiForge...
asked by 30.11.2015 / 16:34
1
answer

How to block the registration of an already registered user

I'm developing an application that manages Courses in ASP.NET MVC, I'm still a beginner, and I'm trying to do the following: The Student has a screen where he lists all the courses for him to choose and make his enrollment in any of these cour...
asked by 08.06.2015 / 15:45
2
answers

EntityFramework complaining of duplicate identifier even with property being null

I have the following classes: Product : public class Produto { [Key] public int Id { get; set; } [MaxLength(70)] [Required(AllowEmptyStrings = false)] public string Descricao { get; set; } [MaxLength(10)] [R...
asked by 08.05.2015 / 21:08
1
answer

List directories and subdirectories

I have a TreeView component, and a structure in the database that already has in the directories subdirectories table. has a field called directive_parent_guid, if it is null it is because it is root, if not, it is some Id of another directory....
asked by 19.02.2015 / 15:52
1
answer

One-To-Many relationship with explicit foreign key name

I'm performing a simple one-to-many mapping via Fluent API specifying which column is used in the mapping, but EF "ignores" the configuration and continues using the default . Mappings: public AtividadeMap() {...
asked by 16.07.2015 / 20:33
1
answer

MySQL Data Entities with Mysql Data 5.3.7

I would like to know if there is any way to use MySQL.Data.Entities with the version of MySQL.Data 5.3.7. In the here statement that works with MySQL.Data (≥ 6.4. 4.0). Is there any other way to use Entity Framewo...
asked by 17.07.2015 / 19:44
1
answer

What is the correct way to declare the following class structure and get its behavior from EntityFramework?

I have the following class structure: public class Revenda { [InverseProperty("Revenda")] public virtual ICollection<UsuarioRevenda> Usuarios { get; set; } } public class Empresa { [InverseProperty("Empresa")] public v...
asked by 30.09.2014 / 23:30
1
answer

IQueryable select data from multiple tables

I have a queryable linq to entities ) in the EntityFramework and I am not able to pull data from two or more tables. For example: var model = _service.List().Where(m => m.DS_GRUPO.Contains(searchString)).Select(m => new { m.PK_GRUPO,...
asked by 15.08.2014 / 21:49
1
answer

Write ListView in SQL Database using Entity Framework and C #

I'm developing a desktop sales application using C # and Entity Framework and am having doubts about writing the items inserted in ListView into the SQL database. How do I write the inserted items to ListView in my table tb_i...
asked by 13.08.2014 / 02:07