|
Home > Archive > Commerce Server General > August 2004 > Reading Marshalled data fields
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Reading Marshalled data fields
|
|
| Ravi Shankar 2004-07-13, 2:48 am |
| The data in the marshalled_data field is automatically
mapped into the dictionary when accessed through the
object. the orderform.item(<key_name> ) OR lineitem.item
(<key_name> ) would get you the data if you're using the
OrderForm or LineItem objects irrespective of PIA or .Net.
Basically the marshalled_data contains the serialized
form of the object dictionaries and should be XML though
it is not recommended to access it this way. The
underlying DBStorage object (PIA) is responsible for this
serialization/deserialization...
HTH
>-----Original Message-----
>I need some help figuring out how to read the
marshalled data. I'm having a
>problem so I desperately need to get at the values in
the marshalled data
>field of the orderform lineitems.
>
>Anyone done this or have a pointer to how it's done?
>
>/harry
>
>
>.
>
| |
| Ashish Kumar [MSFT] 2004-07-13, 5:51 pm |
| It depends on how you are reading the marshalled_data field.
One way is to use DBStorage to load the rows from LinteItems table.
You will do something like this: (C#)
DBStorageClass lineItemStorage = new DBStorageClass();
lineItemStorage.InitStorage(connectionString, "OrderFormLineItems",
"Orderform_id lineitem_id", "Commerce.Dictionary", "marshaled_data",
"d_DateLastChanged");
// Keys is a ISimpleList that contains the values "orderform_id" and
"lineitem_id".
// Values is a ISimpleList that contains the string values of orderform_id
and lineitem_id present in a row in the datatable ordeformlineitems.
IDictionary lineItem = lineItemStorage.LookupData(null, ref Keys, ref
Values) as IDictionary;
if(lineItem != null)
{
// do something
}
else
{
// it was not found
}
--------------------
Content-Class: urn:content-classes:message
From: "Ravi Shankar" <shankar.nospam@hp.com>
Sender: "Ravi Shankar" <shankar.nospam@hp.com>
References: <#ZpWYgFaEHA.2056@TK2MSFTNGP12.phx.gbl>
Subject: Reading Marshalled data fields
Date: Tue, 13 Jul 2004 00:08:20 -0700
Lines: 28
Message-ID: <2c40901c468a8$2d83bfe0$a301280a@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcRoqC2Da8ei4FjkRGqsFpZz0JKvlg==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.commerceserver.general
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.commerceserver.general:14240
NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
X-Tomcat-NG: microsoft.public.commerceserver.general
The data in the marshalled_data field is automatically
mapped into the dictionary when accessed through the
object. the orderform.item(<key_name> ) OR lineitem.item
(<key_name> ) would get you the data if you're using the
OrderForm or LineItem objects irrespective of PIA or .Net.
Basically the marshalled_data contains the serialized
form of the object dictionaries and should be XML though
it is not recommended to access it this way. The
underlying DBStorage object (PIA) is responsible for this
serialization/deserialization...
HTH
>-----Original Message-----
>I need some help figuring out how to read the
marshalled data. I'm having a
>problem so I desperately need to get at the values in
the marshalled data
>field of the orderform lineitems.
>
>Anyone done this or have a pointer to how it's done?
>
>/harry
>
>
>.
>
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
| |
| Jason Sirota 2004-07-14, 5:51 pm |
| Depending on what your marshalled data is, we've also discovered that
you can store custom properties of the marshalled data as flat fields
in the table.
This method is NOT supported by microsoft, so if you modify your
tables in this way, it could cause upgrades to break and so forth. So
please use this method wisely and at your own risk.
If your custom marshalled fields are strings or integers, or other
native type objects that can be stored in SQL server, you can manually
add a field to the OrderFormLineItems, OrderGroup, or OrderForm tables
using Enterprise manager.
Name the field with the same name as your marshalled field and set the
type as the same type as the marshalled field value.
Because of the way the CS objects are written, they store the custom
value in both the marshalled field and the flat field, allowing you
access to it with SQL syntax.
This method can be very useful for displaying custom properties from a
dataset without instantiating the base object and for creating custom
reporting.
AGAIN: AFAIK, THIS IS NOT SUPPORTED, USE AT YOUR OWN RISK.
Thanks!
Jason
| |
|
| I'm trying to use your code and still have a question. Here is what I've got
so far...
using Microsoft.CommerceServer.Interop.Orders;
using Microsoft.CommerceServer.Interop;
using Microsoft.CommerceServer.Runtime;
SimpleList Keys = new SimpleListClass();
Dictionary myDictionary = new DictionaryClass();
//set a value in the dictionary
myDictionary["key1"] = "orderform_id";
myDictionary["key2"] = "lineitem_id";
//the simple list wants an object data type
object x = myDictionary;
//add object to dictionary
Keys.Add(ref x);
SimpleList Values = new SimpleListClass();
Dictionary ValuesDict = new DictionaryClass();
//set a value in the dictionary
ValuesDict["key1"] = "<Value of orderform_id>";
ValuesDict["key2"] = "1";
//the simple list wants an object data type
object y = ValuesDict;
//add object to dictionary
Values.Add(ref y);
string strDSN = "<Value of ConnectionString>";
DBStorageClass lineItemStorage = new DBStorageClass();
lineItemStorage.InitStorage(strDSN, "OrderFormLineItems", "Orderform_id
lineitem_id", "Commerce.Dictionary", "marshaled_data", "d_DateLastChanged");
// Keys is a ISimpleList that contains the values "orderform_id" and
//"lineitem_id".
// Values is a ISimpleList that contains the string values of orderform_id
//and lineitem_id present in a row in the datatable ordeformlineitems.
IDictionary lineItem = lineItemStorage.LookupData(null, ref Keys, ref
Values) as IDictionary;
I'm getting an error when building:
'IDictionary' is an ambiguous reference
Any idea what I can do to fix this?
Thanks.
"Ashish Kumar [MSFT]" wrote:
> It depends on how you are reading the marshalled_data field.
>
> One way is to use DBStorage to load the rows from LinteItems table.
>
> You will do something like this: (C#)
>
> DBStorageClass lineItemStorage = new DBStorageClass();
> lineItemStorage.InitStorage(connectionString, "OrderFormLineItems",
> "Orderform_id lineitem_id", "Commerce.Dictionary", "marshaled_data",
> "d_DateLastChanged");
>
> // Keys is a ISimpleList that contains the values "orderform_id" and
> "lineitem_id".
> // Values is a ISimpleList that contains the string values of orderform_id
> and lineitem_id present in a row in the datatable ordeformlineitems.
> IDictionary lineItem = lineItemStorage.LookupData(null, ref Keys, ref
> Values) as IDictionary;
>
> if(lineItem != null)
> {
> // do something
> }
> else
> {
> // it was not found
> }
> --------------------
> Content-Class: urn:content-classes:message
> From: "Ravi Shankar" <shankar.nospam@hp.com>
> Sender: "Ravi Shankar" <shankar.nospam@hp.com>
> References: <#ZpWYgFaEHA.2056@TK2MSFTNGP12.phx.gbl>
> Subject: Reading Marshalled data fields
> Date: Tue, 13 Jul 2004 00:08:20 -0700
> Lines: 28
> Message-ID: <2c40901c468a8$2d83bfe0$a301280a@phx.gbl>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Thread-Index: AcRoqC2Da8ei4FjkRGqsFpZz0JKvlg==
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
> Newsgroups: microsoft.public.commerceserver.general
> Path: cpmsftngxa06.phx.gbl
> Xref: cpmsftngxa06.phx.gbl microsoft.public.commerceserver.general:14240
> NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
> X-Tomcat-NG: microsoft.public.commerceserver.general
>
> The data in the marshalled_data field is automatically
> mapped into the dictionary when accessed through the
> object. the orderform.item(<key_name> ) OR lineitem.item
> (<key_name> ) would get you the data if you're using the
> OrderForm or LineItem objects irrespective of PIA or .Net.
>
> Basically the marshalled_data contains the serialized
> form of the object dictionaries and should be XML though
> it is not recommended to access it this way. The
> underlying DBStorage object (PIA) is responsible for this
> serialization/deserialization...
>
> HTH
>
> marshalled data. I'm having a
> the marshalled data
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> EBusiness Server Team
|
|
|
|
|