データ アクセスで断続的な問題が発生しているため、プロジェクトを再構築しています。私は、Linq to Entities を使用し、データベースを DATA (DL) レイヤーで App_Data フォルダーに配置した 3 層アーキテクチャを使用しています。データへの唯一の接続文字列は、データ層 (DL) の web.config にあります。
UI の'var GetFeatured'ステートメントで、「タイプ 'DL.RESTAURANT' は、参照されていないアセンブリで定義されています。アセンブリ 'DL への参照を追加する必要があります。」というエラー メッセージが表示されます。UI にはビジネス ロジック レイヤーへの参照があり、ビジネス ロジック レイヤーには DL への参照があります。私は何が欠けていますか?
ユーザー インターフェイス コード ビハインド
BLgetFeatured obj2 = new BLgetFeatured();
int one = 29;
int two = 54;
int three = 49;
int four = 41;
int restID = one;
var GetFeatured = obj2.getFeatured(restID);
var GetFeatured = obj2.getFeatured(restID);
litRestName.Text = GetFeatured[0].REST_NAME;
litRestStreet.Text = GetFeatured[0].REST_STREET1;
litRestPhone.Text = GetFeatured[0].REST_PHONE;
litRestCity.Text = GetFeatured[0].CITY.CITY_NAME;
litRestCuisine.Text = GetFeatured[0].CUISINE.CUISINE_NAME;
litRestShortDesc.Text = GetFeatured[0].REST_DESC;
restImage.ImageUrl = "~/Images/" + GetFeatured[0].REST_IMAGE;
ビジネスロジックレイヤー
using DL;
namespace BL
{
public class BLgetRestaurants
{
public List<RESTAURANT> getRestaurants(string cuisineName, string cityName, string priceName, string ratingName)
{
DLgetRestaurants obj = new DLgetRestaurants();
var restaurantList = obj.getRestaurants(cuisineName, cityName, priceName, ratingName);
return restaurantList;
}
}
}
データ層 (DL)
namespace DL
{
public class DLgetFeatured
{
FCGuide db = new FCGuide();
public List<RESTAURANT> getFeatured(int restID)
{
var restList = (from RESTAURANT in db.RESTAURANTs.Include("CUISINE").Include("CITY")
where RESTAURANT.REST_ID == restID
select RESTAURANT).ToList();
var result = (from RESTAURANT in db.RESTAURANTs.Include("CITY").Include("CUISINE")
where RESTAURANT.CUISINE.CUISINE_ID == RESTAURANT.CUISINE_ID
&& RESTAURANT.CITY.CITY_ID == RESTAURANT.CITY_ID
orderby RESTAURANT.REST_NAME ascending
select RESTAURANT).ToList();
return restList;
}
}
}