Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Class
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01326193
Message ID:
01326318
Views:
17
>>Hi everybody,
>>
>>Is it possible to generate a Data class based on the table? If yes, what should be my steps?
>>
>>Thanks in advance.
>
>A typed DataSet could (and should) be considered as a "Data class based on the table".
>The easiest way to create a typed dataset is to create a new dataset, then drag the table(s) from the server explorer to the dataset surface.
>
>What are your requirements for a Data class based on the table?
>
>Einar

Hi Einar,

I found a separate project that contained, for example, Person.cs class with this start
using System;
using System.IO;
using System.Drawing;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.ComponentModel;
using FriendC;

namespace FriendC
{
	/// <summary>
	/// Person Class.
	/// </summary>
    [DataObject()]
	public class Person
	{
        private string ConnectionString;

        #region Constructors
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="SiteID"></param>
        public Person(int SiteID)
        {
            this.ConnectionString = Util.ConnectionString;
            this.sid = SiteID;
        }

        /// <summary>
        /// Default Constructor
        /// </summary>
        public Person()
            : this(-1)
        {
            this.inPersonId = -1;
        }

        /// <summary>
        /// Constructor to be used for bulk creation of people objects
        /// </summary>
        /// <param name="PersonID">Person ID</param>
        /// <param name="FirstName">First Name</param>
        /// <param name="MiddleName">Middle Name</param>
        /// <param name="LastName">Last Name</param>
        /// <param name="Address1">Address Line 1</param>
        /// <param name="Address2">Address Line 2</param>
        /// <param name="City">City</param>
        /// <param name="State">State</param>
        /// <param name="Zip">Zip Code</param>
        /// <param name="HomePhone">Home Phone Number</param>
        /// <param name="CellPhone">Cell Phone</param>
        /// <param name="Email">Email</param>
        /// <param name="ScreenName">Screen Name</param>
        /// <param name="DOB">Date of Birth</param>
        /// <param name="UserName">Username for Website</param>
        /// <param name="Password">Password</param>
        /// <param name="PersonTypeCode">Person Type Code<seealso cref="FriendC.PersonType"/></param>
        /// <param name="FatherID">Father ID</param>
        /// <param name="MotherID">Mother ID</param>
        /// <param name="Comment">Comment</param>
        /// <param name="SiteID">Site ID</param>
I was wondering how was this class created and may I create something similar for a different table.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform