A: 

Quick Note

I renamed UserData to ExtendedProperty and this caused the relationship from User to ExtendedProperty to be called ExtendedProperties.

Summary of changes

  1. Created a getter/setter for both FirstName and LastName in the partial User class
  2. Grabbed the correct ExtendedProperty element out of the ExtendedProperties collection and either returned or updated the Value property of it.
  3. Refactored into a reusable format as shown below
partial class User
{
    public string FirstName
    {
     get { return (string)this.getExtendedProperty("FirstName").Value; }
     set { this.getExtendedProperty("FirstName").Value = value; }
    }

    public string LastName
    {
     get { return (string)this.getExtendedProperty("LastName").Value; }
     set { this.getExtendedProperty("LastName").Value = value; }
    }

    // Grab a related property out of the collection, any changes to it will be reflected in the database after a submit
    private ExtendedProperty getExtendedProperty(string KeyName)
    {
     // grab the properties that fit the criterea
     var properties = (from prop in this.ExtendedProperties where prop.KeyName == KeyName select prop);

     // return value
     ExtendedProperty property = properties.SingleOrDefault();

     // if this is a new user then there arent going to be any properties that match
     if (property == null)
     {
      // Define a new item to add to the collection
      property = new ExtendedProperty()
      {
       ItemID = this.UserID,
       KeyName = KeyName,
       Value = String.Empty
      };

      // Add the item we're about to return to the collection
      this.ExtendedProperties.Add(property);
     }

     // either way we have a valid property to return at this point
     return property;
    }
}

I just hope this isn't bloated / grossly inefficient.

Edit

In getExtendedProperty, it would error when setting the FirstName or LastName of a newly created User because it would not have any corresponding ExtendedProperty elements in the ExtendedProperties collection as shown below.

User expected = new User();
expected.UserID = Guid.NewGuid();
expected.UserName = "LJ";
expected.FirstName = "Leeroy";  // It would error here
expected.LastName = "Jenkins";

Because of this I added a check to ensure that new items get added to the ExtendedProperties collection if they are requested and not currently in there.

I also removed setExtendedProperty since I felt it wasn't necessary and was just a method around a 1 liner anyway.

I would really appreciate any feedback before I accept this answer, I'll let it sit for a few days.

Allen
A: 

Personally I feel its bad form but I suppose everyone has there way of doing things. Why can't you assign userdata in the users table? I think I might not be understanding the design idea here.

FailBoy
The main reason why I cant is because I am phasing out horribly old code and introducing linq to sql as an ORM, meaning I have to abide by the same schema and design as the old objects. Ideally, yes, I would just assign user data in the users table
Allen
ouch, that sucks man, but I now understand why you need to be able to do it like this. good luck! Hope the rest of the system isn't in a similar state!
FailBoy