Entity Framework Inserting or Updating a Table with Foreign Key
Tech-Today

Entity Framework Inserting or Updating a Table with Foreign Key


For example you have 2 lookup entities:
Country and Province

And Your Person Entity has country and province field. In short both CountryId and ProvinceId are foreign keys to Person table.

How to setup the Insert Statement (Update is almost the same, just query the Person Entity first). Assuming we have variables countryId and provinceId.
var person = new Person {
FirstName = "rhed",
LastName = "czetsuya",
Country = Entities.Country.First(p=>p.CountryId==countryId),
Country = Entities.Province.First(p=>p.CountryId==provinceId),
}
Entities.AddToPerson(person);
Entities.SaveChanges();




- How To Encrypt And Decrypt An Object In And From A File In Java
There are times when we need to write something on a file, but doesn't want it to be readable as a plain text. In this case we can use any type of encryption mechanism, but what if we want to decrypt the encrypted file back and read its contents....

- How To Call Java Rest Web Service In Soapui
The following code is an explanation of how you can call a rest web service in java. Below you can find the actual java code and soapUI configuration. We enumerate 3 type of methods namely: POST, PUT and DELETE. How to call rest web service using soapUI...

- How To Declare Foreign Key In Entity Framework
There are 2 ways to declare foreign key in entity framework. Assuming we have 2 entities aspnet_Users and Person, which are link via UserId from aspnet_Users. 1.) class Person { public Guid UserId { get;set; } [ForeignKey("UserId")] public virtual...

- Executing A Linq Query With A Bridge Table Like Aspnet_users And Aspnet_roles
Using model first approach, we add aspnet_Users, aspnet_Roles and aspnet_UsersInRoles in the edmx file. But why is aspnet_UsersInRoles missing? It's because aspnet_Users has one-to-many relationship to aspnet_Roles. To get the role of the user, we...

- Create A New Seam Web Project In Eclipse-helios
In this exercise we will be building seam web project in eclipse. It's long so stay focus :-D. What you need (The following should be installed correctly): Note: in parentheses is where I installed mine. 1.) Jboss seam 2.2.1 (C:\jboss-seam-2.2.1)...



Tech-Today








.