So I a built a very basic Elastic example using just one Type (Products) I was able to use automap to build this and all worked well, now I want to expand on this and add more types I am running into issues but without any real exceptions being thrown to give me a clue as to what is going wrong.
class Product
{
public int ProductId { get; set; }
public string Name { get; set; }
public string ProductCode { get; set; }
public string Barcode { get; set; }
public Nullable<int> ProductCategoryId { get; set; }
public int Length { get; set; }
public int Height { get; set; }
public int ProductTypeId { get; set; }
public string Url { get; set; }
public Nullable<int> ProductBrandId { get; set; }
public int Width { get; set; }
public string Html { get; set; }
public string Description { get; set; }
public string MetaTitle { get; set; }
public string MetaKeywords { get; set; }
public string MetaDescription { get; set; }
public decimal CostPrice { get; set; }
public Nullable<int> ProductBuyingPriceId { get; set; }
public int DispatchTimeInDays { get; set; }
public int LeadTimeInDays { get; set; }
public string ManufacturerPartNumber { get; set; }
public string Notes { get; set; }
public int StockAvailable { get; set; }
public decimal WeightKg { get; set; }
public Nullable<int> SellingPriceGroupId { get; set; }
public Nullable<decimal> ReviewRating { get; set; }
public int ReviewRatingCount { get; set; }
public bool NonReturnable { get; set; }
public bool LimitedStock { get; set; }
public Nullable<int> TaxRateId { get; set; }
public virtual ProductCategory ProductCategory { get; set; }
}
class ProductCategory
{
public int ProductCategoryId { get; set; }
public string Name { get; set; }
public Nullable<int> ParentProductCategoryId { get; set; }
public string FullPath { get; set; }
public string Code { get; set; }
}
private void button1_Click(object sender, EventArgs e)
{
var des = new CreateIndexDescriptor("myindex")
.Mappings(ms => ms
.Map<Product>(m => m.AutoMap())
.Map<ProductCategory>(m => m.AutoMap())
);
var res = elasticClient.CreateIndex(des);
Output.AppendText(res.ToString());
Output.AppendText(Environment.NewLine);
Output.AppendText("Index Created");
Output.AppendText(Environment.NewLine);
}
As mentioned if I just Include it works fine if I add Product Category nothing happens. TIA
谢谢您的答复正如Russ所说,我正在尝试使用多种无法使用的类型
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.