473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Ent LIb Config block: deserialize SqlParameterClass

using the June 2005 edition of the Ent Lib.

I can serialize a SqlParameterCollection using
ConfigurationManager.GetConfiguration() but WriteConfiguration() does not
seem to be able to deserialize that same parameter. A small sample app
follows.

How can I accomplish this?

In the example below mytest is created with the _myName variable as "Billy"
but the _pcol variable as undefined.

****code example************

using System;
using System.Data.SqlClient;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Configuratio n;

namespace AccountUserMigration
{
public class Test{
private SqlParameterCollection _pcol;
private string _myName;

public string myName{
get{return this._myName;}
set{this._myName = value;}
}

public SqlParameterCollection pcol{
get{return this._pcol;}
set{this._pcol = value;}
}

public Test(){}

public void PrepForSerialization(){
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add("@one",SqlDbType.VarChar);
cmd.Parameters.Add("@two",SqlDbType.Int);
this.pcol = cmd.Parameters;
this.myName = "Billy";
}

static void Main(){
//Test mytest = new Test(), mytest2 = new Test();
//mytest.PrepForSerialization();
//ConfigurationManager.WriteConfiguration("TestConfi guration",mytest);

Test mytest2 =
(Test)ConfigurationManager.GetConfiguration("TestC onfiguration") as Test;
}
}
}

**************************
Nov 17 '05 #1
1 1576
kevin,

I have found the best place for questions about ent lib is

http://www.gotdotnet.com/codegallery...2-91be63527327

HTH

Ollie Riches

"kevin" <ke***@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
using the June 2005 edition of the Ent Lib.

I can serialize a SqlParameterCollection using
ConfigurationManager.GetConfiguration() but WriteConfiguration() does not
seem to be able to deserialize that same parameter. A small sample app
follows.

How can I accomplish this?

In the example below mytest is created with the _myName variable as
"Billy"
but the _pcol variable as undefined.

****code example************

using System;
using System.Data.SqlClient;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Configuratio n;

namespace AccountUserMigration
{
public class Test{
private SqlParameterCollection _pcol;
private string _myName;

public string myName{
get{return this._myName;}
set{this._myName = value;}
}

public SqlParameterCollection pcol{
get{return this._pcol;}
set{this._pcol = value;}
}

public Test(){}

public void PrepForSerialization(){
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add("@one",SqlDbType.VarChar);
cmd.Parameters.Add("@two",SqlDbType.Int);
this.pcol = cmd.Parameters;
this.myName = "Billy";
}

static void Main(){
//Test mytest = new Test(), mytest2 = new Test();
//mytest.PrepForSerialization();
//ConfigurationManager.WriteConfiguration("TestConfi guration",mytest);

Test mytest2 =
(Test)ConfigurationManager.GetConfiguration("TestC onfiguration") as Test;
}
}
}

**************************

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike | last post by:
Hi I am using one of the Microsoft building blocks called User Interface Process what this block basically does it control the flow/state of your application. This block works great with...
1
by: Jorge Besada | last post by:
I am planning on using the Configuration Management Application Block. The Block reads the app.config file the first time it is used. What if I want to add a new section/configSection and have the...
4
by: grs | last post by:
Can a class library have a app.config file. Reason for asking is that the microsoft application blocks all read from myApp.exe.config. How can you use the application blocks if you do not have an...
1
by: MrXs | last post by:
i have a setting form for my program and wish to allow the setting to be saved and reopened to the last set setting on program startup.. lets say i have a xml file like this : <?xml...
9
by: ALI-R | last post by:
Hi,, I have two questions : 1) Is it mandatory that config file of a desktop application must be App.config 2) Is it possible to update config file in your code?? thanks for your help. ALI
5
by: SP | last post by:
Please advice. I am not familiar with the concepts of windows service. I am trying to access a xml configuration file from windows service. But it is failing. configuration file is in the same...
0
by: Tom P | last post by:
I'm using System.Configuration in .NET 2.0 to load in values from an externally specified config file and deserialize them into a C# class. During deserialization, I'm getting an exception thrown...
17
by: Fred Nelson | last post by:
Hi: I have written several web applications that obtain their connection strings from the web.config file. This is very easy to use and it makes it easy to move an app from development into...
1
by: Harold Howe | last post by:
When .NET loads an app.config at runtime (myapp.exe.config), will it honor an entity declaration? Based on what I am seeing, the answer is no, but I think, or hope, that I am doing something wrong....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.