473,379 Members | 1,278 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,379 software developers and data experts.

Avoid properties persistence in ASP.NET

Is there a way to avoid public custom properties to persist in the
ASPX code?
I'have a class for columns collection in a Web Control i'm writing.
This class must to implement the IStateManager interface and so the
ITrackingManager read-only property is required. When the control
persist the collection it persist this property too and generate a
runtime error.
I've readed abouth the NotSerialized attribute but it's a solution for
public fiels only (not for properties).
Is there anyone can help me ?
Nov 16 '05 #1
2 1661
Puoi postare un esempio?

Con serializzazione ad Xml, ad esempio, posso scrivere

[XmlRoot(ElementName("MyClass"))]
public class MyClass
{
private string s = "Ciao";

[XmlIgnore]
public string MyProperty
{
get { return s; }
set { s = value; }
}
}

hmmmm.... mi sa che non ho capito il tuo problema, o che la
serializzazione che stai facendo tu segue regole diverse da quella per
Xml che ho usato io.

F.O.R.

Nov 16 '05 #2
Scusa se non ho descritto bene il mio problema:
Stò scrivendo un Web Control che richiede una proprietà di tipo derivato
da CollectionBase. Per poter gestire correttamente il ViewState questo
tipo deve implementare l'interfaccia IStateManager che richiede una
proprietà pubblica IsTrackingViewState. Se definisco questa proprietà e
non uso nessun attributo ottengo due effetti indesiderati:
1) la proprietà viene listata nel properties browser a design time
2) la proprietà viene resa persistente nel codice ASPX della pagina che
contiene il controllo.

Ho comunque risolto entrambi i problemi usando BrowsableAttribute(false)
e
DesignerSerializationVisibility(Hidden)
come attributi della proprietà da "nascondere".

Non avevo googlato abbastanza :-<
Grazie comunque.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

0
by: PerfectDayToChaseTornados | last post by:
Hi All, I'm interested in peoples opinions & experiences of various persistence frameworks. I mainly use EJB2 or straight JDBC for persistence, but have been looking at various alternative...
2
by: Frank Grimm | last post by:
Hi group, i'm looking for a Java persistence framework that is able to cope with changes of the class source, i.e. new/changed attributes and/or methods. Say you have an exported (persistent)...
6
by: Paolo Losi | last post by:
Hi all, I'm pretty new to the python language so please excuse me if this is FAQ... I'm very glad to be part of the list! :-) I'm looking into a way to implement a generic workflow framework...
1
by: Joe | last post by:
I was wondering if there are any recommended persistence frameworks for use in .NET that could be recommended. I am looking for the following requirements: Free/Open Source or very inexpensive....
10
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in...
1
by: Samuel R. Neff | last post by:
We're using XmlSerializer to serialize our data objects for persistence in a WinForms app. This is our primary data store, we're not web connected and are not using a database. We've had to...
2
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
5
by: Chris Spencer | last post by:
Before I get too carried away with something that's probably unnecessary, please allow me to throw around some ideas. I've been looking for a method of transparent, scalable, and human-readable...
6
by: manstey | last post by:
I have a ClassWrapper that wraps around a third party database object. Each database object has a set of properties, like columns in a relational database. I want my wrapper to generate a...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.