, RavenDB , - id . , , , - . :
using (var session = docStore.OpenSession())
{
foreach (var csvItemToImport in csvfile)
{
var existingDoc = session.Load<Contact>(csvItemToImport.Email);
if (existingDoc == null)
{
session.Store(new Contact{ ... });
}
else
{
existingDoc.MemberOf.Add(csvItemToImport.ListName)
}
}
session.SaveChanges();
}
doc URL- (/docs/contacts/blah@blah.co.uk), "@" .
POCO :
public class Contact
{
public string Id { get; set; }
public string Name { get; set; }
public string Country { get; set; }
public List<string> MemberOf { get; set; }
}
, , ( - ). . 2 , Contact doc , .