This question is locked. New answers and comments are not allowed.
Hi,
I try this sample :
- one object "User" with some propreties ID (auto-increment and primary key, Login, Level, Name, Mail).
- one object "Services" with some properties (Descrption).
I made a assiociation between this object :
- one user have some services
- one services have one user
==> I create my database schema...
==> and I play this code ....(see has follow)
==> In my database there is no relation between table (key that be realized the relation is null)
==> can you explain to me why ?
For information, to obtain user key in the Services table, I am obliged to add this follow line :
Services o_Services = new Services();
o_Services.Description= "Activité 1";
==> o_Services.User = o_User; I think that is not obliged to add this line ?????? I don't know why, is it necesseray to add this line to obtain key in my database. I think that the line "o_User.Services.Add(o_Services);" is sufficient !
o_User.Services.Add(o_Services);
o_Services = new Services();
o_Services.Description = "Activité 2";
==> o_Services.User = o_User;
o_User.Services.Add(o_Services);
o_Bll_Users.Add(o_User);
In advance,
thanks
Richard.
I try this sample :
- one object "User" with some propreties ID (auto-increment and primary key, Login, Level, Name, Mail).
- one object "Services" with some properties (Descrption).
I made a assiociation between this object :
- one user have some services
- one services have one user
==> I create my database schema...
==> and I play this code ....(see has follow)
User o_User = new User();
o_User.Login = "Login 1";
o_User.Level = Common.Enums.e_User_Level.Operateur;
o_User.Mail = "mail1";
o_User.MDP = "*";
Services o_Services = new Services();
o_Services.Description= "Activité 1";
o_User.Services.Add(o_Services);
o_Services = new Services();
o_Services.Description = "Activité 2";
o_User.Services.Add(o_Services);
o_Bll_Users.Add(o_User);
==> In my database there is no relation between table (key that be realized the relation is null)
==> can you explain to me why ?
For information, to obtain user key in the Services table, I am obliged to add this follow line :
Services o_Services = new Services();
o_Services.Description= "Activité 1";
==> o_Services.User = o_User; I think that is not obliged to add this line ?????? I don't know why, is it necesseray to add this line to obtain key in my database. I think that the line "o_User.Services.Add(o_Services);" is sufficient !
o_User.Services.Add(o_Services);
o_Services = new Services();
o_Services.Description = "Activité 2";
==> o_Services.User = o_User;
o_User.Services.Add(o_Services);
o_Bll_Users.Add(o_User);
In advance,
thanks
Richard.