Click here to Skip to main content
15,918,243 members

Comments by nagendrathecoder (Top 200 by date)

nagendrathecoder 29-Dec-16 4:47am View    
Can you explain your question a bit more.
What exactly you want to insert into SQL? A record in some table?
nagendrathecoder 12-Mar-15 8:07am View    
So what's the problem? You can get examples for reading and writing to xml files from google.
nagendrathecoder 3-Mar-15 22:51pm View    
Hi Dave,
I am also working on code first approach and have similar structure as OP mentioned but i did not received such error. Below is an example of how i am defining my data:

[Table("State")]
public partial class State
{
public int StateId { get; set; }

[Required]
[StringLength(50)]
public string Name { get; set; }

[Required]
[StringLength(50)]
public string ShortName { get; set; }

public virtual ICollection<city> Cities { get; set; }
}

[Table("City")]
public partial class City
{
[Key]
public int CityId { get; set; }

[Required]
[StringLength(50)]
public string Name { get; set; }

[Required]
[StringLength(50)]
public string ShortName { get; set; }

public int StateId { get; set; }

public virtual State State { get; set; }
}

Now suppose i removed int StateId from City class, EF will still add foreign key column of StateId in city table.
But while inserting into city, how i will be able to insert value for stateId?
Do i have to populate the Virtual State property? If yes then will it be a bit time consuming?
nagendrathecoder 25-Feb-15 22:23pm View    
It is not clear. Can you tell how you like to store strings in array after splitting?
nagendrathecoder 25-Feb-15 4:18am View    
Do we have to guess the errors?