سلام دوستان من میخواستم یک دیتا بیس از طریق Code first ایجاد کنم ..
اما نمیدونم مشکلم کجاست ؟؟! و چرا به اروو میخوردم ؟؟ من کانکشن استیرنگ هم ب صورت زیر تعریف کردم .. دوستان میتونن راهنمایی کنن؟؟
ویا یک نمونه میخواستم دیتا بیس از طریق Code first برام بزارین ..
<coectionStrings> <add name="SchoolContext" coectionString="Data Source=.;Initial Catalog=SchoolContext;Integrated Security=True" providerName="System.Data.SqlClient" />
</coectionStrings>
| static void Main(string[] args) { var ctx = new SchoolContext(); Student stud = new Student() { StudentName = "New Student" }; ctx.Students.Add(stud); } public class SchoolContext : DbContext } public class Student } public Teacher Teacher { get; set; } public Standard Standard { get; set; } public class Standard } public ICollection<Student> Students { get; set; } } } |
برچسب:
نویسنده: محمد رضا جوادیان