Created
April 1, 2024 03:37
-
-
Save hendrasyp/e4e5452b8878b5a4de362135bbf49a72 to your computer and use it in GitHub Desktop.
Execute Stored Procedure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IService{ | |
public Task<MyModel> Get_MyMethod(); | |
} | |
public class Service : IService { | |
public async Task<MyModel> Get_MyMethod(){ | |
// 1. Buat list parameter | |
List<SqlParam> parameters = new List<SqlParam>(); | |
parameters.Add(new SqlParam { ParamType = DataTypeConstant.NUMERIC, ParamValue = partnerKey }); // @ID | |
// 2. Jika hasil akan ditampung dalam model | |
MyModel myModel = new MyModel(); | |
List<MyModel> myModelList = RepositoryHelper.Execute<MyModel>(_options, "NAMA_SEP", parameters); | |
// 2.A Jika hasil akan ditampung dalam list dictionary | |
MyModel myModel = new MyModel(); | |
List<Dictionary<string, dynamic>> myModelList = RepositoryHelper.Execute<Dictionary<string, dynamic>>(_options, "NAMA_SEP", parameters); | |
// 3. Logic tambahan (jika ada) | |
if (myModelList.Count > 0) | |
{ | |
myModel = myModelList[0]; | |
} | |
return await Task.FromResult(myModel); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment