Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Framework entity
Hi all
I have a database with no constreains and no relations. This is just a converted flat-file database and must not be touched.
 
I nead to create entities with relations and tryed this:
 
[Table("Customers")]
public class customer
{
    [Key, Column("CustoemrID")]
    public int Id{get;set;}
 
    [Column("CustomerName")]
    public string Name{get;set;}
 
    [Column("Zip")]
    public int Zip{get;set;}
 
    [ForeignKey("Zip")]
    public ZipCode{get;set;}
}
[Table("ZipCodes")]
public class ZipCode
{
    [Key, Column("ZipCode")]
    public int ZipCode{get;set;}
    
    [Column("Name")]
    public string Name{get;set;}
}
 
I get errors on this and wander if there are some other ways to do this
Posted 8-Mar-12 21:28pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 335
1 OriginalGriff 250
2 DamithSL 170
3 Kornfeld Eliyahu Peter 130
4 Peter Leow 95
0 OriginalGriff 7,315
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,917
3 Maciej Los 4,866
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 9 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100