• 0

entity framework 4.1 two tables with the same property name


Question

i'm having some problems with entity framework and a sql database. so my problem is this: in my database there are two tables that have the same property, they are identical in type and length but they are not related in any way. no foreign key whatsoever. as soon as i start to interact with the database entity framework spits out the famous error:

error 0019: Each property name in a type must be unique. Property name was already defined.

i'm using the code first approach and a sql server 2008 by the way.

this is one of the class representations of the tables:


[Table("bo")]
public class TbPBO
{
[Required(AllowEmptyStrings = false, ErrorMessage = "O campo de nome nao pode ser nulo")]
[MaxLength(55, ErrorMessage = "O campo de nome nao pode ter mais que 55 caracteres")]
[Column("nome", TypeName = "char", Order = 4)]
public string TbBonome { get; set; }
}[/CODE]

this is the other class representation of the table:

[CODE]
[Table("bi")]
public class TbPBi
{
[Required(AllowEmptyStrings = false, ErrorMessage = "O campo nome nao pode ser nulo")]
[MaxLength(55, ErrorMessage = "O campo nome nao pode ter mais que 55 caracteres")]
[Column("nome", TypeName = "char", Order = 62)]
public string TbBinome { get; set; }
}
[/CODE]

any idea on how to work around this? one more thing. the database must not be changed in any way. i cannot modify it.

help would be appreciated. thanks in advance

3 answers to this question

Recommended Posts

  • 0

I haven't hit this issue before, but see if this helps: http://stackoverflow.com/questions/2060278/c-sharp-entity-framework-the-entitycontainer-name-must-be-unique-an-entityc

If not, try searching other topics on SO, it's quite resourceful.

  • 0

i've solved the problem by installing ef power tools and reverse engineer my database. it created the entities and context. i've been testing the code and it works. no more problems.

thanks for the help

This topic is now closed to further replies.
  • Posts

    • Save 35% on Sony's SS-CS5M2 3-way high-res bookshelf speakers by Taras Buria Sony is currently offering a big discount on its SS-CS5M2 bookshelf speaker, saving you 35% on a set of high-quality audio equipment. The SS-CS5M2 is a passive 3-way bookshelf speaker with a 5.12-inch woofer, a 25 mm soft-dome tweeter, and a 19 mm super tweeter. This design allows different drivers to handle different parts of the sound spectrum for a clearer, more detailed audio when watching movies or listening to music. The compact cabinet size allows you to place these speakers on shelves, desks, or stands, making them a practical choice for apartments, bedrooms, and small living rooms. Despite its compact size, the SS-CS5M2 delivers up to 100 W of power. Note that since the speakers are passive, you will need an amplifier to drive them. However, if you do, you can use them for high-resolution music, thanks to a claimed frequency response of 53 Hz - 50 kHz. It is able to extend so far high in the spectrum as a result of those super tweeters. While they will work with most amplifiers and AV receivers, Sony says this pair is a perfect match for its AV receivers, such as STRDH190, 590, 790, or 1000. Sony CS Bookshelf Speakers SS-CS5M2 3-Way 3-Driver Hi-res - $178 | 36% off on Amazon US This Amazon deal is US-specific and not available in other regions unless specified. This is a first-party seller link (at the time of article publishing); ensure that you also purchase from a first-party seller link only. If you don't like it or want to look at more options, check out the previous deals that we have covered, OR you can also visit Amazon US deals page. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • So they somehow expect Apple to easily make it so that if I install say DeepSeek that DS can then handle all the tasks that Siri would be doing while integrated in the OS? That sounds like just rediculous.
    • For ray-tracing, the Radeon RX 9070 XT is better than the GeForce RTX 5070, but worse than the GeForce RTX 5070 Ti The Radeon RX 9070 XT is similar to the GeForce RTX 5070 Ti in rasterization Both AMD and NVIDIA have had serious issues with drivers in the past, so I can't say that one is better or worse than the other. Yes. AMD has better support Linux than does NVIDIA. Use Display Driver Uninstaller (DDU) to uninstall NVIDIA's drivers before installing AMD's drivers. That's up to you. Supplies of memory is unpredictable because AI using up a lot of memory. As a result, there is a lot of volatility in video card prices.
    • Promoting is fine - advertising, informing, whatever.  But interrupting your PAID OS experience is not.
  • Recent Achievements

    • One Month Later
      pinnclepd earned a badge
      One Month Later
    • First Post
      X-No-file earned a badge
      First Post
    • One Month Later
      johnjacobb40 earned a badge
      One Month Later
    • One Year In
      Primer1st earned a badge
      One Year In
    • Experienced
      JayZJay went up a rank
      Experienced
  • Popular Contributors

    1. 1
      +primortal
      510
    2. 2
      PsYcHoKiLLa
      215
    3. 3
      +Edouard
      145
    4. 4
      Steven P.
      88
    5. 5
      ATLien_0
      83
  • Tell a friend

    Love Neowin? Tell a friend!