/// <summary> /// 商品IDから商品名を取得する /// </summary> /// <param name="productId"></param> /// <returns></returns> private static string SelectProductName(int productId) { string productName = string.Empty; using (var _db = new LearnAppsEntities()) { var mst_product = _db.MST_Product.SingleOrDefault(c => c.ProductId == productId); if (mst_product != null) { productName = mst_product.ProductName; } } return(productName); }
static void Main(string[] args) { string orderXmlPath = Properties.Settings.Default.OrderXmlPath; string orderXmlDirName = "Order02"; string orderXmlFileName = "Order.xml"; string orderXmlFilePath = Path.Combine(orderXmlPath, orderXmlDirName, orderXmlFileName); FileStream fs = new FileStream(orderXmlFilePath, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(Orders)); //Xml Serialize Orders orders = (Orders)serializer.Deserialize(fs); using (var _db = new LearnAppsEntities()) { foreach (var item in orders.Order.Articles.articleList) { var mst_product = _db.MST_Product.Single(c => c.ProductId == item.ProductId); } } Log log = new Log(); }