1

I know this is pretty silly but just wondered if anyone had a link or knows exactly what this code is doing on my page?

namespace com.gvinet.EblAdapter.ebl
{
    [Serializable]
    [DesignerCategory("code")]
    [GeneratedCode("System.Xml", "4.0.30319.225")]
    [DebuggerStepThrough]
    [XmlType(Namespace = "http://addresshere")]
    public class TSAPassenger
    {

then here is all of the strings for the form like name, address and such

I am thinking it is trying to grab the XML file that was created from the Database but just want to make sure.

hmmftg
  • 1,274
  • 1
  • 18
  • 31
user1566783
  • 399
  • 1
  • 4
  • 18
  • Just to clarify: they don't belong to the namespace; they blong to the class below. – Sedat Kapanoglu Aug 03 '12 at 17:23
  • well you pasted really nothing but Attributes, what code exactly are you wanting to know what it's doing.. update your post.. this will cause you negative votes if you are not specific enough and others whom are trying will get frustrated.. ask yourself the question.. would you be able to answer the same question if someone else posted code like you just posted ..this is to abstract.. – MethodMan Aug 03 '12 at 17:24

3 Answers3

0

The Serializable and XmlType attributes are instructing the XML serializer that the class can be serialized and the schema to use when doing so.

nabrond
  • 1,368
  • 8
  • 17
0

It is not. These are all just metadata attributes.

Serializeable - Use the standard XmlSerializer to take public properties and fields and convert to XML for transport using no customization to the format (like ISerializable would). It is usually only used when going out of process (remoting, Web Services, WCF, etc)

DesignerCategory - This can be used a number of ways. This one tends to be used by the property grid in visual studio as a way to organize sections.

GeneratedCode - The application generated it for you, utilizing the System.Xml namespace in version 4.0.

DebuggerStepThrough - If you are stepping through code (F11), by default, skip over anything here (don't step into a property getting for example).

XmlType - Part of the serializer that allows you to provide a specific namespace that is generated in the output.

The items here do not actually get anything, just describe certain aspects of how something may be loaded/handled.

Hope that makes sense.

Chris
  • 731
  • 1
  • 7
  • 18
  • Yes that makes a lot of sense because I am trying to find the connection to the database and havent found that file yet and was just making sure it wasnt through datasets in xml through this page. – user1566783 Aug 03 '12 at 17:24
  • if you are trying to find a connection to the database.. then do a global search for something like SQLConnection Object.... – MethodMan Aug 03 '12 at 17:26
  • What type of database is it? Are you using Entity Framework? Linq2Sql? Datasets, EntLib? – Chris Aug 03 '12 at 17:27
  • Yes I believe I found my connection file. Yes using entity framework with an oracle db. – user1566783 Aug 03 '12 at 17:33
  • Alright, then *likely* it's not stored as XML. If the file was added by entity framework (assuming yes) it has column mappings for each field. Entity framework makes it serializable so you can easily pass it across the wire (without worrying about a second step necessarily). If in your EDMX designer you have a entity called TSAPassenger and it has independent fields, I have a high confidence it's not stored as raw xml. Simple test, if you do select * from tsapassenger do you get a single column back with XML data or just a row of data? – Chris Aug 03 '12 at 17:38
  • I guess that is where all of the problems have stemmed from and why I am trying to sort through this is in the DB I dont see a table that is just TSAPassenger so I figured it was just using that property and somewhere doing all of the joins to create this property type to be used on the form but I cant find this area where all the calls are happening and joining things together. There is another property TSAPassenger collection too. Sorry pretty confusing. – user1566783 Aug 03 '12 at 17:51
  • Don't apologize, everyone starts somewhere. Could you clarify what you mean by you are trying to sort through this in the dB and you don't see a table that is just TSAPassenger. If you look at your EDMX designer, is there anything like "passenger" there? You can name logical tables to map to physical ones. The other option is this was generated from something else (T4, plugin, plethora of things). Are you using EF Code First? – Chris Aug 03 '12 at 17:55
  • Yeah it is hard to explain but the db has over 562 tables in it but TSAPassenger isnt one. I believe they have used the passenger as an object to join all of the different databases into one thing. So i am more or less trying to find that file where its joins all of the tables and assigns it to the TSAPAssenger property but the only page i see is the one above and it just has a lot of this in the property public Address1 Address { get; set; } – user1566783 Aug 03 '12 at 18:00
  • Alright, lets try something slighty different. If you right click on the TSAPassanger class name, choose "Find All References". Lets see if we can find all the locations the class is used (you can double click the found line to go directly to code). That should indicate how it's at least being hydrated. – Chris Aug 03 '12 at 18:08
  • When i go into the class TSAPassenger it says it from metadata on the tab not sure if that has anything to do with it, but When i click on it on this page it doesnt move but I dont have the find all references option tho. – user1566783 Aug 03 '12 at 18:14
0

These are attributes - used for declarative programming - you can find more about declarative programming online. But here is the link to .net attribute hierarchy page to get you started: http://msdn.microsoft.com/en-us/library/aa311259(VS.71).aspx

Also, these pages may be helpful:

Community
  • 1
  • 1
Tom
  • 510
  • 1
  • 7
  • 24
  • he's not looking for that if you read his full comments below he;s searching for SqlConnection the issue / problem needs to be edited.. – MethodMan Aug 03 '12 at 17:27
  • ohk - seems like he's got his answer - started typing before there was any comment or replies. – Tom Aug 03 '12 at 17:31
  • 1
    @DJKRAZE - I've removed your comments because they were insulting to the asker. Please treat people here with respect, no matter their skill level. – Brad Larson Aug 03 '12 at 17:42
  • Thanks Brad and yes I am a bit of a newbie because I just switched from PHP developing into .Net again and its a bit of a transition so not sure you would be able to do that either DJ so trying to piece things out piece by piece. – user1566783 Aug 03 '12 at 17:45