Click here to Skip to main content
14,828,012 members
Home / Discussions / C#
   

C#

 
GeneralRe: My thoughts on C# Pin
Gerry Schmitz4-Jun-19 6:53
mveGerry Schmitz4-Jun-19 6:53 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 18:44
MemberBrian_TheLion4-Jun-19 18:44 
QuestionHow to perform the content of a variable as a C# instruction Pin
Member 133074841-Jun-19 10:02
MemberMember 133074841-Jun-19 10:02 
AnswerRe: How to perform the content of a variable as a C# instruction Pin
BillWoodruff1-Jun-19 15:33
mveBillWoodruff1-Jun-19 15:33 
GeneralRe: How to perform the content of a variable as a C# instruction Pin
Member 133074841-Jun-19 18:22
MemberMember 133074841-Jun-19 18:22 
AnswerRe: How to perform the content of a variable as a C# instruction Pin
jschell2-Jun-19 8:53
Memberjschell2-Jun-19 8:53 
QuestionHow To Make This Generic Pin
Kevin Marois31-May-19 11:55
professionalKevin Marois31-May-19 11:55 
AnswerRe: How To Make This Generic Pin
#realJSOP1-Jun-19 5:00
mva#realJSOP1-Jun-19 5:00 
0) I don't understands the need for such code (maybe it's just the way you presented your example), but...

1) You'd call that method something like this: RulesBL bl = this.GetBL<RulesBL>(connstring, dbName);

2) IMHO, it seems to me that you're genericizing the wrong end of things (again, it may be the example you presented). I've done something similar, but I genericized the DAL (the base class for my BLL objects) to accept any model class I specify. My DAL contains the generic model handling, and the BLL objects (I have over 20) are concrete and simply call the DAL. I use whatever appropriate BLL object is necessary in my controllers to get/set data, and the DAL handles the models using reflection.

In my controller I have this:

DBObjectMyDB bll = new DBObjectMyDB(connstring);
// if i need to pass paremeters
SqlParameter[] parameters = new SqlParameter[]{new SqlParameter("@id", idValue)}; 
List<MyObject> list = bll.GetMyObect(parameters);


or this:

DBObjectMyDB bll = new DBObjectMyDB(connstring);
int recs = bll.SaveMyObject(model);


In the BLL:

public List<MyObject> GetMyObject(SqlParameter[] parameters)
{
    List<MyObject> list = this.ExecuteStoredProc<MyObject>("spGetMyObject", parameters);
    return list;
}


or

// all of my models that might save data to the database have a property called 
// ToSqlParameters so I can keep the bll code tidier
public int SaveMyObject(MyObject model)
{
    int recs = this.ExecuteStoredProc("spSaveMyObject", model.ToSqlParameters);
    return recs;
}


The DAL is where all the generic stuff is.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

QuestionAsk C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
Dhjjf29-May-19 22:15
MemberDhjjf29-May-19 22:15 
AnswerRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
BillWoodruff29-May-19 22:41
mveBillWoodruff29-May-19 22:41 
AnswerRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
Eddy Vluggen29-May-19 22:56
professionalEddy Vluggen29-May-19 22:56 
AnswerRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
OriginalGriff29-May-19 23:00
mveOriginalGriff29-May-19 23:00 
AnswerRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
#realJSOP30-May-19 4:55
mva#realJSOP30-May-19 4:55 
GeneralRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
Eddy Vluggen30-May-19 7:20
professionalEddy Vluggen30-May-19 7:20 
GeneralRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
#realJSOP30-May-19 7:24
mva#realJSOP30-May-19 7:24 
PraiseRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
Eddy Vluggen30-May-19 7:29
professionalEddy Vluggen30-May-19 7:29 
SuggestionRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
Richard Deeming30-May-19 7:46
mveRichard Deeming30-May-19 7:46 
GeneralRe: Ask C# everyone God, about SQLiteHelper increase delete to modify the static to directly call the way Pin
#realJSOP1-Jun-19 5:02
mva#realJSOP1-Jun-19 5:02 
QuestionFile keeps getting corrupted on just one machine Pin
jkirkerx29-May-19 12:51
professionaljkirkerx29-May-19 12:51 
AnswerRe: File keeps getting corrupted on just one machine Pin
Dave Kreskowiak29-May-19 13:11
mveDave Kreskowiak29-May-19 13:11 
GeneralRe: File keeps getting corrupted on just one machine Pin
jkirkerx29-May-19 13:17
professionaljkirkerx29-May-19 13:17 
AnswerRe: File keeps getting corrupted on just one machine Pin
Dave Kreskowiak29-May-19 13:13
mveDave Kreskowiak29-May-19 13:13 
GeneralRe: File keeps getting corrupted on just one machine Pin
jkirkerx29-May-19 13:25
professionaljkirkerx29-May-19 13:25 
QuestionDownload files Pin
Member 1447263829-May-19 0:23
MemberMember 1447263829-May-19 0:23 
AnswerRe: Download files Pin
#realJSOP29-May-19 0:36
mva#realJSOP29-May-19 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.