私はWindowsアプリケーションを開発しています。私はデータベースから生成するモデルタイプのエンティティモデルを持っています。最初にいくつかのストアドプロシージャをインポートしました.1つのSPに対して、データ型をboolからintに置き換えるコンテキストを変更しました。現在、モデルを更新しようとすると(SPを追加すると)、変更されたSPのコンテキストがデフォルトのタイプに戻ります。つまり、boolがエラーになります(関数に無効な引数があります)。既存のストアドプロシージャのEntityModel.Contextの更新を回避する方法
これはモデルのContext.csです。ここで私は型をboolからintに変更すると、アプリケーションは正常に動作していますが、モデルを更新するときに型がboolに戻り、そのエラーがスローされます。これを避ける方法は?私はSPアクセスしていますがどのように
public virtual ObjectResult<Web_get_obj_details_Result> Web_get_obj_details(Nullable<byte> hcode, Nullable<byte> vcode, Nullable<byte> yearcode, Nullable<short> tranno)
{
var hcodeParameter = hcode.HasValue ?
new ObjectParameter("hcode", hcode) :
new ObjectParameter("hcode", typeof(byte));
var vcodeParameter = vcode.HasValue ?
new ObjectParameter("vcode", vcode) :
new ObjectParameter("vcode", typeof(byte));
var yearcodeParameter = yearcode.HasValue ?
new ObjectParameter("yearcode", yearcode) :
new ObjectParameter("yearcode", typeof(byte));
var trannoParameter = tranno.HasValue ?
new ObjectParameter("tranno", tranno) :
new ObjectParameter("tranno", typeof(short));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Web_get_obj_details_Result>("Web_get_obj_details", hcodeParameter, vcodeParameter, yearcodeParameter, trannoParameter);
}
:ここ
IList<Web_get_obj_details_Result> ObjWeb_get_obj_details_Result = EntityObj.Web_get_obj_details(HobliCode, VillageCode, YearCode,TranNo).ToList<Web_get_obj_details_Result>();
をHobliCode、VillageCode、YearCode、TranNoはint型です。
FYI:これは私がそのSPの文脈に私がモデルを更新するたびに変更したくない私のSP
ALTER PROCEDURE [dbo].[Web_get_obj_details]
@hcode as tinyint , @vcode as tinyint , @yearcode as tinyint , @tranno as smallint
as
declare @dcode as integer , @tcode as integer
begin tran
select @dcode = dist_code , @tcode = taluk_code from mst_config
select convert(varchar(10),notice_sdate,103) as notice_sdate ,convert(varchar(10),obj_date,103) as obj_date,objector_name,obj_details from tr_objection
where dist_code= @dcode and taluk_code = @tcode and hobli_code = @hcode and village_code = @vcode and tran_no [email protected] and [email protected]
commit tran
です。任意のソリューション??なぜ型がint型であっても、型がbool型を取り出すのはなぜですか?
あなたがまたは '' byte' bool'を意味ですか? – Sefe
@sefe申し訳ありません..バイトです。 – Rakesh