Hello i have been trying out the new xConnect in Sitecore 9. I am now trying to add custom facets to xConnect. To deploy these i need to create a json representation of my model.
I have created a class library with my facets and CollectionModel.
public class CollectionModel
{
public static XdbModel Model { get; } = BuildModel();
private static XdbModel BuildModel()
{
XdbModelBuilder modelBuilder = new XdbModelBuilder("DemoModel", new XdbModelVersion(1, 0));
modelBuilder.DefineFacet<Contact, CartInfo>(CartInfo.DefaultFacetKey);
modelBuilder.DefineFacet<Interaction, StoreInfo>(StoreInfo.DefaultFacetKey);
return modelBuilder.BuildModel();
}
}
[Serializable]
[FacetKey(DefaultFacetKey)]
class CartInfo : Facet
{
public const string DefaultFacetKey = "CartInfo";
public List<Product> Products { get; set; }
}
[Serializable]
[FacetKey(DefaultFacetKey)]
class Product : Facet
{
public const string DefaultFacetKey = "Product";
public Guid ID { get; set; }
}
[Serializable]
[FacetKey(DefaultFacetKey)]
class StoreInfo : Facet
{
public const string DefaultFacetKey = "StoreInfo";
public Guid StoreID { get; set; }
public string ManagerName { get; set; }
public List<Product> ActiveOffers { get; set; }
}
Now i am trying to convert this to json and export it to a file in a console application like so:
var model = Sitecore.XConnect.Serialization.XdbModelWriter.Serialize(CollectionModel.Model);
File.WriteAllText(CollectionModel.Model.FullName + ".json" , model);
When i run this i get the following error:
FileNotFoundException: Could not load file or assembly ‘System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263’ or one of its dependencies. The system cannot find the file specified.
Does anyone know what i am missing?