Click here to Skip to main content
15,354,474 members
Home / Discussions / C#
   

C#

 
GeneralRe: Clarification Pin
TNCaver17-Apr-22 14:16
MemberTNCaver17-Apr-22 14:16 
GeneralRe: Clarification Pin
Richard Deeming18-Apr-22 21:56
mveRichard Deeming18-Apr-22 21:56 
AnswerRe: Accessing one of many possible objects passed to a function Pin
Gerry Schmitz18-Apr-22 5:31
mveGerry Schmitz18-Apr-22 5:31 
QuestionHow to trigger an event with a COM port? Pin
Member 1405587913-Apr-22 2:10
MemberMember 1405587913-Apr-22 2:10 
AnswerRe: How to trigger an event with a COM port? Pin
Ralf Meier13-Apr-22 2:47
mveRalf Meier13-Apr-22 2:47 
AnswerRe: How to trigger an event with a COM port? Pin
OriginalGriff13-Apr-22 2:48
mveOriginalGriff13-Apr-22 2:48 
AnswerRe: How to trigger an event with a COM port? Pin
Raphael Adeniji13-Apr-22 11:31
MemberRaphael Adeniji13-Apr-22 11:31 
QuestionNeed help advice Pin
hardsoft11-Apr-22 18:06
Memberhardsoft11-Apr-22 18:06 
I have an app in csharp dot net version 4.7.1 and moving to dotnet version 6.

The snippet of code from 4.7.1 is

Quote:
using System.Web; // requires a reference to System.Web.dll
using System.Web.Configuration; // requires a reference to System.Configuration.dll

///
/// Imports an xml store by it's relative path in ASP.NET and returns the requested connection.
/// Does not open the connection.
///

/// <param name="httpContext" />Context of HTTP request to resolve relative path with. (e.g. HttpContext.Current)
/// <param name="configurationFileName" />Full or relative server path. (e.g. ~/App_Data/databases.xml)
/// <param name="connectionName" />Returns a new instance of the provider's class that represents a connection to the database.
public static DbConnection Open(HttpContextBase httpContext, string configurationFileName, string connectionName)
{
DbConnection connection = Connection(httpContext, configurationFileName, connectionName);
connection.Open();
return connection;
}

///
/// Imports an xml store by it's relative path in ASP.NET and returns the requested connection.
/// Does not open the connection.
///

/// <param name="httpContext" />Context of HTTP request to resolve relative path with. (e.g. HttpContext.Current)
/// <param name="configurationFileName" />Full or relative server path. (e.g. ~/App_Data/databases.xml)
/// <param name="connectionName" />Returns a new instance of the provider's class that represents a connection to the database.
/// <returns>Returns a new instance of the provider's class that represents a connection to the database.
public static DbConnection Connection(HttpContextBase httpContext, string configurationFileName, string connectionName)
{
Sources.ImportXmlStore(httpContext.Server.MapPath(configurationFileName));
return Connection(connectionName);
}


I cannot use
using System.Web;
using System.Web.Configuration;

as these don't exist in 6.0 so would appreciate help on how to convert the following to keep the same functionality.

Quote:
DbConnection connection = Connection(httpContext, configurationFileName, connectionName);


and

Quote:
public static DbConnection Connection(HttpContextBase httpContext, string configurationFileName, string connectionName)


Many thanks for any help.
AnswerRe: Need help advice Pin
Gerry Schmitz12-Apr-22 4:59
mveGerry Schmitz12-Apr-22 4:59 
GeneralRe: Need help advice Pin
hardsoft12-Apr-22 13:25
Memberhardsoft12-Apr-22 13:25 
GeneralRe: Need help advice Pin
Gerry Schmitz12-Apr-22 13:41
mveGerry Schmitz12-Apr-22 13:41 
GeneralRe: Need help advice Pin
hardsoft12-Apr-22 14:04
Memberhardsoft12-Apr-22 14:04 
QuestionProblem to read Com port with while loop? Pin
Member 1405587911-Apr-22 0:55
MemberMember 1405587911-Apr-22 0:55 
AnswerRe: Problem to read Com port with while loop? Pin
OriginalGriff11-Apr-22 1:28
mveOriginalGriff11-Apr-22 1:28 
AnswerRe: Problem to read Com port with while loop? Pin
Raphael Adeniji11-Apr-22 2:39
MemberRaphael Adeniji11-Apr-22 2:39 
AnswerRe: Problem to read Com port with while loop? Pin
Luc Pattyn11-Apr-22 12:21
sitebuilderLuc Pattyn11-Apr-22 12:21 
QuestionMigrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Raphael Adeniji10-Apr-22 19:44
MemberRaphael Adeniji10-Apr-22 19:44 
AnswerRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Richard MacCutchan10-Apr-22 21:28
mveRichard MacCutchan10-Apr-22 21:28 
GeneralRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Raphael Adeniji11-Apr-22 2:28
MemberRaphael Adeniji11-Apr-22 2:28 
GeneralRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Richard MacCutchan11-Apr-22 6:06
mveRichard MacCutchan11-Apr-22 6:06 
QuestionWill calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver9-Apr-22 18:42
Memberpr1mem0ver9-Apr-22 18:42 
AnswerRe: Will calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver9-Apr-22 20:20
Memberpr1mem0ver9-Apr-22 20:20 
GeneralRe: Will calling a new method/property work if called on a "base" abstract object Pin
OriginalGriff9-Apr-22 22:16
mveOriginalGriff9-Apr-22 22:16 
GeneralRe: Will calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver10-Apr-22 6:10
Memberpr1mem0ver10-Apr-22 6:10 
QuestionProblem with BackgroundWorker component? Pin
Member 140558797-Apr-22 1:23
MemberMember 140558797-Apr-22 1:23 

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.