Here is my Image.cs and ImageMap.cs and DbContext Class, also I have column for image which is byte array... please see if you can help me...
************************************************* public partial class IMAGE { public int ID { get; set; } public int? ITEMSTYLEID { get; set; } public int? USERID { get; set; } public int? CUSTOMERID { get; set; } public byte[] PICTURE { get; set; } public virtual CUSTOMER CUSTOMER { get; set; } public virtual ITEMSTYLE ITEMSTYLE { get; set; } public virtual USER USER { get; set; } } ************************************************* public class IMAGEMap : EntityTypeConfiguration<IMAGE> { public IMAGEMap() { // Primary Key HasKey(t => t.ID); // Properties Property(t => t.PICTURE) .IsRequired(); // Table & Column Mappings ToTable("IMAGE", "Firebird"); Property(t => t.ID).HasColumnName("ID"); Property(t => t.ITEMSTYLEID).HasColumnName("ITEMSTYLEID"); Property(t => t.USERID).HasColumnName("USERID"); Property(t => t.CUSTOMERID).HasColumnName("CUSTOMERID"); Property(t => t.PICTURE).HasColumnName("PICTURE"); // Relationships HasOptional(t => t.CUSTOMER) .WithMany(t => t.IMAGEs) .HasForeignKey(d => d.CUSTOMERID); HasOptional(t => t.ITEMSTYLE) .WithMany(t => t.IMAGEs) .HasForeignKey(d => d.ITEMSTYLEID); HasOptional(t => t.USER) .WithMany(t => t.IMAGEs) .HasForeignKey(d => d.USERID); } } { static Entities() { Database.SetInitializer<Entities>(null); } public Entities() : base("Name=Entities") { } public Entities(string connectionString) : base(connectionString) { } public Entities(DbConnection entityConnection) : base(entityConnection, true) { } public DbSet<ADDRESS> ADDRESSes { get; set; } snip... public DbSet<IMAGE> IMAGEs { get; set; } snip... public DbSet<VENDOR> VENDORs { get; set; } public override int SaveChanges() { try { return base.SaveChanges(); } catch (DbUpdateConcurrencyException e) { if (e.GetType() == typeof (DbUpdateConcurrencyException)) { //Update the values of the entity that failed to save from the store e.Entries.GetEnumerator().Current.Reload(); } EmailException.ExceptionEmail(e); return 0; } } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Configurations.Add(new ADDRESSMap()); snip... modelBuilder.Configurations.Add(new IMAGEMap()); snip... modelBuilder.Configurations.Add(new VENDORMap()); } } -----Original Message----- From: MuthuAnnamalai [mailto:muthuannama...@sbcglobal.net] Sent: Friday, March 22, 2013 6:27 AM To: For users and developers of the Firebird .NET providers Subject: Re: [Firebird-net-provider] Code First Error But the Model is created by C# Entity Framework Power tool and I checked the Image table mapping class which has mapping for primary key defined... Sent from my iPad On Mar 22, 2013, at 3:07 AM, Jiri Cincura <disk...@cincura.net> wrote: > On Fri, Mar 22, 2013 at 3:05 AM, Muthu Annamalai > <muthuannama...@sbcglobal.net> wrote: >> >> System.Data.Entity.Edm.EdmEntityType: EntityType ‘Image’ has no key >> defined. Define the key for this EntityType. >> >> System.Data.Entity.Edm.EdmEntitySet: EntityType EntitySet ‘Images is >> based on the type ‘Image’ that has no key defined. Define the key for >> this EntityType. > > I think this is pretty clear. You didn't specified the key(s) for your entity. > >> All the tables in our database has primary key defined. And all the > > Which is not relevant here. The error is about model, not database. > >> primary keys have Description set to #PK_GEN#. Any clue to fix this >> error is > > #PK_GEN# is used only when you *generate* EDM. > > -- > Jiri {x2} Cincura (x2develop.com founder) http://blog.cincura.net/ | > http://www.ID3renamer.com > > ---------------------------------------------------------------------- > -------- Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics Download AppDynamics Lite > for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > Firebird-net-provider mailing list > Firebird-net-provider@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider