Rudyard Murdough Solutions

  • About
  • Consulting
  • Contact

My Thoughts on the Entity Framework

Posted by rmurdough on February 11, 2011
Posted in: Asp.net, C#. Leave a Comment

Seven months ago I started programming for a new company, it was here that I was first exposed to the Entity framework. Since developing several systems that used Entity for data abstraction I have been greatly impressed with its abilities. Still several things trouble me which I will cover in this posting.

Integration of Entity into Application

Many seasoned programmers I have discussed this with and myself greatly despise instances where programmers will code inline SQL statements throughout an application wherever a database call is necessitated rather than containing them in a centralized repository or data abstraction layer. Myself having first hand experience upgrading systems that were based around this design, I can personally attest to what a headache it is to upgrade every database call when they are scattered throughout the system rather than contained in a single location. Recently I have upgraded a system to Entity that was built around another object-relational mapping system similar to Entity. The obvious benefit provided by Entity and other ORMs is that the ORM will do all the work of creating the data model and writing all of the SQL queries. Also it is convenient how Entity can be called from anywhere in an application context providing access to the data in a relational object structure. Many systems built around ORMs including the one I just upgraded to Entity have all the ORM calls coded into the application logic as needed. (As the example below illustrates…)

void _button1_OnClick(object sender, EventArgs e)
{
    string name = _name_textbox.Text;
    using(EntityDataModel context = new EntityDataModel())
    {
        User user = context.Users.FirstOrDefault(p=>p.Name == name);
        if(user!=null)
        {
            _phone_textbox.Text = user.Phone;
        }
    }
}

I agree this makes database integration very easy into an application, but I question the longevity of this design. I pose the question, how is this different than inline SQL statements? Your response may be that the ORM serves the purpose of the data abstraction layer and separates the program logic from the database. But what happens when the next popular ORM comes around? Your application is completely integrated and dependent on the now obsolete ORM.  Now don’t get me wrong, im a fan of Entity and love to take advantage of its revolutionary features. So here is an example of how I recommend implementing Entity…

public interface IDataAbstraction
{
    User GetUser(string name);
}
public class EntityDataAbstraction : IDataAbstraction
{
    public User GetUser(string name)
    {
        User user = null;
        using(EntityDataModel context = new EntityDataModel())
        {
            user = context.Users.FirstOrDefault(p=>p.Name == name);
        }
        return user;
    }
}
class Default
{
    void _button1_OnClick(object sender, EventArgs e)
    {
        IDataAbstraction abstraction_layer = new EntityDataAbstraction();
        User user = abstraction_layer.GetUser(_name_textbox.Text);
        if(user!=null)
        {
            _phone_textbox.Text = user.Phone;
        }
    }
}

You can see in my example how I encapsulate all of the Entity code inside a class that implements our Interface defining the data abstraction layer to the rest of the application. This way in the inevitable day that Entity becomes obsolete, it will be very easy to upgrade your application to the next and greatest ORM!

Singleton Design Pattern with C#

Posted by rmurdough on December 31, 2010
Posted in: C#, Design Patterns. Tagged: abstraction, c#, class, data, design, instance, layer, pattern, singleton. Leave a Comment

In my previous post I wrote about one way to design and build a data model and data abstraction layer in C#. Well, the data abstraction class doesn’t do much good unless its instantiated. So in this post I am going to write about one way you could instantiate your data abstraction class to access it from anywhere in your program and only ever have a single instance of this class in your entire program context.

Enter the Singleton Design Pattern, this is a pattern of instantiating any variable in a static member, then providing a static global accessor to it exposing access to the application. In my experience this works very well at times when I have a resource intensive object like a Data Abstraction Layer which encapsulates something like a database connection; that I only ever want one instance of, but yet I need it to be accessible from the entire application context. In the sample code below you can see how I would instantiate the Data Abstraction Layer class from the previous post.

using System;
using System.Collections.Generic;
using System.Text;

namespace SomeApp.Controllers
{
    public class StateController
    {
        private static IStorageController _data_access;

        public static void Init()
        {
            _data_access = new PostgreSqlStorageController();
        }
        public static IStorageController DataAccess
        {
            get { return _data_access; }
            set { _data_access = value; }
        }
    }
}

You notice I provide the static method Init(), in your application you would call this using StateController.Init(); from the proper entry point depending on your application. This assigns a new instance of PostgreSqlStorageController to the private static member _data_access. This is then accessed via the public static property named DataAccess. Which is then accessible from anywhere in your application context simply by calling SomeApp.Controllers.StateController.DataAccess.

Thanks for reading and feel free to leave a comment or send me a message!

C# – Principles of the Data Model and Abstraction Layer

Posted by rmurdough on November 27, 2010
Posted in: Asp.net, C#, Design Patterns. Tagged: abstraction, ado.net, c#, database, sql, xml. Leave a Comment

A software application can have the most amazing user interface ever designed, but this interface does not do much good for the future of the application if the data model has a flawed design. This is why it is imperative for the developer to to not cut corners or time on designing the data model and its database implementation. What I will outline in this post is a way of designing the data model and abstraction layer that I have used for some time and been quite pleased with its performance and maintainability. I once was a developer that did not have a concept for abstraction layers, so this resulted in me throwing database calls wherever I needed one. Some time ago I was called up to maturity by some very talented developers who taught me the principles of building my applications around a data model and building an abstraction layer to handle the storage and retrieval of data objects. If you are a fellow developer who has never heard of such things, today is your day, I am calling you into maturity as a software developer and will teach you these concepts as you read on.

Part 1 – The Data Model

When designing the data model for my projects, I like to have all my class definitions inherit a common base class. This enables me to mandate common attributes that all objects in the model should have. Such as a unique identifier (Recnum in example below), or a time stamp of when the object was created or last updated. In this base class I also define the methods needed to create a XML string from the object instance, or restore the object instance from a XML string. You will see how this is used later in the post.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace SomeApp.Core.Data
{
    [Serializable]
    public class StorableObject
    {
        private int _recnum = -1;
        private DateTime _create_date;
        private DateTime _update_date;

        public StorableObject()
        {

        }

        public int Recnum
        {
            get { return _recnum; }
            set { _recnum = value; }
        }
        public DateTime CreateDate
        {
            get { return _create_date; }
            set { _create_date = value; }
        }
        public DateTime UpdateDate
        {
            get { return _update_date; }
            set { _update_date = value; }
        }
        public string GetXml()
        {
            string xml = "";
            using (StringWriter writer = new StringWriter())
            {
                XmlSerializer serializer = new XmlSerializer(this.GetType());
                serializer.Serialize(writer, this);
                xml = writer.ToString();
            }
            return xml;
        }
        public static StorableObject GetObject(string xml, Type type)
        {
            StorableObject obj = null;
            using (StringReader reader = new StringReader(xml))
            {
                XmlSerializer serializer = new XmlSerializer(type);
                obj = (StorableObject)serializer.Deserialize(reader);
            }
            return obj;
        }
    }
}

In the following example you can see how a data model class definition is implemented using the StorableObject. Automatically the data object inherits the fields of StorableObject, and the necessary methods to serialize into XML and deserialize from XML. In this pattern, the developer would build a object with all the fields he would traditionally put in a table.

using System;

namespace SomeApp.Core.Data
{
    [Serializable]
    public class User : StorableObject
    {
        private string _email;
        private string _first_name;
        private string _last_name;
        private string _password;

        public User () : base()
        {

        }

        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }
        public string FirstName
        {
            get { return _first_name; }
            set { _first_name = value; }
        }
        public string LastName
        {
            get { return _last_name; }
            set { _last_name = value; }
        }
        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }
        public string FullName
        {
            get { return _first_name + " " + _last_name; }
        }
    }
}

Part 2 – The Database

After defining the data model the developer will need to build the database tables to hold all this data. In the following example, I define the table “users” to store the User object. The “users_sequence” SQL snippet creates the sequence which produces the unique identifier which will be stored in the Recnum field.

CREATE SEQUENCE users_sequence
   INCREMENT 1
   MINVALUE 1
   MAXVALUE 9223372036854775807
   START 10
   CACHE 1;
ALTER TABLE users_sequence OWNER TO postgres;

CREATE TABLE users
(
   recnum integer NOT NULL DEFAULT nextval('users_sequence'::regclass),
   email text NOT NULL,
   "xml" text NOT NULL,
   CONSTRAINT "Users_PK" PRIMARY KEY (recnum),
   CONSTRAINT "Users_Email" UNIQUE (email)
)
WITH (
   OIDS=FALSE
);
ALTER TABLE users OWNER TO postgres;

I do not create a database field for each field in my storage class, but instead I just create fields I need search indexes for and leave storing the rest of the class up to the “xml” field. There are pros and cons to this design that I can see.

Pros: The pros obviously are when storing large objects your tables and SQL statements remain small and simple. Also this design provides benefits for when scaling the data model. You can add a new field to the storage class and not have to touch the abstraction layer. The developer can create extensive intricate objects, and as long as each sub object is marked as Serializable, it will be maintained in the databases. Also the Serializer handles all the pesky work of type preservation. In the instance a new search index is needed, the developer simply creates just that field in the database and updates the abstraction layer.

Cons: I have yet to find the perfect design that offers the best benefits of performance and scalability. One tradeoff with this design is that each row consumes much more space than it would with a traditional database layout. This is because combining all the object’s values plus the necessary XML markup creates a rather long string. Where as traditionally each value would be in its own type specific column, thus removing the XML markup. Another tradeoff is for each index column there is a duplicate of this value in the “xml” field. If the abstraction layer pattern I outline below is followed, then these values should never be out of sync unless someone was to manually change the value in the database itself. So the real tradeoff is the additional amount of space that is used with the duplicate data. One workaround for this would be to set the [XmlIgnore] attribute on the index fields if this is a concern. In all, these are decisions that the designer has to make for himself when designing his application.

Part 3 – The Abstraction Layer

I always define my abstraction layers based on a interface. Then I keep my application coded in such a way that all it knows is that it is calling type IStorageController, never the implementation of IStorageController. This is a good pattern for whenever the application is interfacing with a third party component, such as a database provider. Because the developer never knows when the project requirements may change and one day you may be coding for MySql, then the next day you could be coding for PostgreSql. If this rule is properly followed, then you would only have to touch code in your implementation class, and not have to change any application code expect for where the implementation is instantiated. This saves many many headaches and keeps your application very scalable!

using System;
using System.Collections.Generic;
using System.Data;

namespace SomeApp.Core.Controllers
{
    public interface IStorageController
    {
        void StoreUser(User user);
        User GetUser(int recnum);
        User GetUserByEmail(string email);
        List<User> GetAllUsers();
        void DeleteUser(User user);
    }
}

In this example I have IStorageController implemented as PostgreSqlStorageController. All my database commands are using the wonderful Npgsql assembly. This is a wonderful project with the goal of building a Ado.net compliant data provider for PostgreSql.

using System;
using System.Collections.Generic;
using Npgsql;
using SomeApp.Core.Data;

namespace SomeApp.Core.Controllers
{
    public class PostgreSqlStorageController : IStorageController
    {
        private NpgsqlConnection _connection;

        public PostgreSqlStorageController ()
        {
            _connection = new NpgsqlConnection ("User ID=someuser;Password=somepass;Host=localhost;Port=5432;Database=somedb;");
            _connection.Open ();
        }

        #region IStorageController implementation
        public void Close ()
        {
            _connection.Close ();
        }
        public void StoreUser (User user)
        {
            using (NpgsqlCommand cmd = _connection.CreateCommand ())
            {
                if (user.Recnum >= 0)
                {
                    user.UpdateDate = DateTime.Now;
                    cmd.CommandText = "UPDATE users SET email=@email, xml=@xml WHERE recnum=@recnum;";
                    cmd.Parameters.Add ("@recnum", user.Recnum);
                }
                else
                {
                    user.CreateDate = DateTime.Now;
                    cmd.CommandText = "INSERT INTO users (email, xml) values(@email, @xml);";
                }
                cmd.Parameters.Add ("@email", user.Email);
                cmd.Parameters.Add ("@xml", user.GetXml ());
                cmd.ExecuteNonQuery ();
            }
        }
        public User GetUserByEmail (string email)
        {
            User user = null;
            using(NpgsqlCommand cmd = _connection.CreateCommand ())
            {
                cmd.CommandText = "SELECT * FROM users WHERE email=@email;";
                cmd.Parameters.Add ("@email", email);
                NpgsqlDataReader reader = cmd.ExecuteReader ();
                if (reader.Read ())
                {
                    user = (User)User.GetObject (reader["xml"].ToString (), typeof(User));
                    user.Recnum = Convert.ToInt32 (reader["recnum"]);
                }
                reader.Close ();
            }
            return user;
        }
        public User GetUser (int recnum)
        {
            User user = null;
            using(NpgsqlCommand cmd = _connection.CreateCommand ())
            {
                cmd.CommandText = "SELECT * FROM users WHERE recnum=@recnum;";
                cmd.Parameters.Add ("@recnum", recnum);
                NpgsqlDataReader reader = cmd.ExecuteReader ();
                if (reader.Read ())
                {
                    user = (User)User.GetObject (reader["xml"].ToString (), typeof(User));
                    user.Recnum = Convert.ToInt32 (reader["recnum"]);
                }
                reader.Close ();
            }
            return user;
        }
        public void DeleteUser (User user)
        {
            using (NpgsqlCommand cmd = _connection.CreateCommand ())
            {
                cmd.CommandText = "DELETE FROM users WHERE recnum=@recnum;";
                cmd.Parameters.Add ("@recnum", user.Recnum);
                cmd.ExecuteNonQuery ();
            }
        }
        public List<User> GetAllUsers ()
        {
            List<User> users = new List<User> ();
            using(NpgsqlCommand cmd = _connection.CreateCommand ())
            {
                cmd.CommandText = "SELECT * FROM users;";
                NpgsqlDataReader reader = cmd.ExecuteReader ();
                User user;
                while (reader.Read ())
                {
                    user = (User)User.GetObject (reader["xml"].ToString (), typeof(User));
                    user.Recnum = Convert.ToInt32 (reader["recnum"]);
                    users.Add (user);
                }
                reader.Close ();
            }
            return users;
        }
        #endregion
    }
}

In the above code snippet you can see several examples of how to store and retrieve records for this data model. You can follow this pattern or create your own, but there are several things I would like to point out with this. Notice each time I call the GetObject method on the storage class, passing in the XML string from the database and then cast the object to the return type and assign to the return variable. After each instance of this, I always set the corresponding fields in the object for each of my index columns.  There should never be a instance where the value in these index columns would be out of sync with the corresponding value in the XML. But just in case I always like to make sure the value in the object being sent off into the application is the exact same value that the object selection was based on. There is one exception to this rule; because the
“recnum” field is auto-generated by the database, after the object is inserted, the Recnum field in the XML will not be populated until the object is again updated in the database. So it is imperative that after the object is casted in the return variable, that the Recnum field be set from the “recnum” column in the database.

I hope you enjoyed reading this and found it to be useful. Please feel free to comment or contact me with any questions or ideas to improve on this design. Thanks!

Compile JavaScript into C# Assembly & Dynamically Link with Server Control

Posted by rmurdough on November 12, 2010
Posted in: Asp.net, C#. Tagged: .net, asp.net, html, javascript, jquery, mono, script. Leave a Comment

If you are an Asp.net developer who has ever built a server control, you’ve probably needed to use JavaScript in some form or fashion. What if you could compile a JavaScript file into your assembly and had it dynamically linked to the page whenever that server control was deployed? How much would your application benefit from such a design? Here’s how to build it:

Step 1

Create the directory structure representing the namespace you want your JavaScript file to be referenced from. (assembly namespace + sub directory structure = path of embeded resource) Add the JavaScript file to your solution. In the properties pane change the build action to be an Embedded Resource. The wording of this option varies between MonoDevelop and Visual Studio. The screenshot below was taken from MonoDevelop. I use jQuery as my example script for this post. (Because I use jQuery in almost all my web development.)

Solution Explorer

Step 2

After you have added the JavaScript to your solution, you need to add references in
AssemblyInfo.cs so that ClientScript can generate a web resource Url for the file. Add the following lines to the bottom of the AssemblyInfo.cs in the Properties folder on your project.


[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
//add these lines
[assembly: WebResource("SomeApp.Web.Core.js.jquery-1.4.2.min.js", "text/javascript")]
[assembly: WebResource("SomeApp.Web.Core.js.jquery-ui-1.8.custom.min.js", "text/javascript")]
////

Step 3

You can do this however you want, but I like to have a central class that provides a static method that I just call. It registers my common scripts (such as jQuery) into my server control with a single call. Below is an example of how to register embedded script resources into a Control or Page. Feel free to use my methods or change it up however you want. I use RegisterClientScript to register compiled JavaScript files that are specific for a single control.

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SomeApp.Web.Core
{
	public class ScriptFactory
	{
		public static void RegisterJQuery (Page page)
		{
			string js = page.ClientScript.GetWebResourceUrl (typeof(ScriptFactory), "SomeApp.Web.Core.js.jquery-1.4.2.min.js");
			page.ClientScript.RegisterClientScriptInclude ("jquery", js);
		}
		public static void RegisterJQueryUi (Page page)
		{
			string js = page.ClientScript.GetWebResourceUrl (typeof(ScriptFactory), "SomeApp.Web.Core.js.jquery-ui-1.8.custom.min.js");
			page.ClientScript.RegisterClientScriptInclude ("jquery-ui", js);
		}
		public static void RegisterClientScript (WebControl control, string key, string path)
		{
            string js = control.Page.ClientScript.GetWebResourceUrl(control.GetType(), path);
            control.Page.ClientScript.RegisterClientScriptInclude(key, js);
		}
	}
}

Step 4

Implementing this is very easy to do. Create a class that inherits from
System.Web.UI.WebControls.WebControl and override the OnPreRender method. Then simply add the call to the ScriptFactory as shown below.

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SomeApp.Web.Core.Controls
{
    public class SomeControl : WebControl
	{
		public SomeControl() : base(HtmlTextWriterTag.Div)
		{

		}
		protected override void OnPreRender (EventArgs e)
		{
			base.OnPreRender (e);
			ScriptFactory.RegisterJQuery (this.Page);
            ScriptFactory.RegisterClientScript(this, "SomeControlScript", "SomeApp.Web.Core.Controls.SomeControlScript.js");
		}
	}
}

The output in your HTML ends up looking something like this…

<!--These lines are generated by Asp.net-->
<script src="/WebResource.axd?d=uvywOXOi-Vlnt2oupRTngLdnO1IJ3ewtHnFQcKLWte3EJkP5YYbnW4wCBxGgBX7hvTlJ1f9Lqdl6jWfpa-l8iCeCjuMh4RSzZfKxxp0WlX2HTfRmiULtee_xrRgEUhevdzfRCN6vdvNfoL58NO07GLsODZg1&amp;t=634253303971914681" type="text/javascript"></script>
<script src="/WebResource.axd?d=yLjrr29Duv6Fvx2N3Jrdti6v8CKHsOyfFxcNEeIug9YbWmgBS-G9uYJfYP2M2M1uCB07WIUif6lIZLllnIMVuJZD59fScOqro374r6mxBSgUBfnYSDYDmWzUnzXtnOnk3i4RluhmnqQjISlczp06PPaIa7U1&amp;t=634253303971914681" type="text/javascript"></script>
<!---->
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;namespace JennysList.Web.Core
{
public class ScriptFactory
{
public static void RegisterJQuery (Page page)
{
string js = page.ClientScript.GetWebResourceUrl (typeof(ScriptFactory), “JennysList.Web.Core.js.jquery-1.4.2.min.js”);
page.ClientScript.RegisterClientScriptInclude (“jquery”, js);
}
public static void RegisterJQueryUi (Page page)
{
string js = page.ClientScript.GetWebResourceUrl (typeof(ScriptFactory), “JennysList.Web.Core.js.jquery-ui-1.8.custom.min.js”);
page.ClientScript.RegisterClientScriptInclude (“jquery-ui”, js);
}
public static void RegisterClientScript (WebControl control, string key, string path)
{
string js = control.Page.ClientScript.GetWebResourceUrl (control.GetType (), path);
control.Page.ClientScript.RegisterClientScriptInclude (key, js);
}
}
}

Seamlessly Update Asp.net Server Control with jQuery

Posted by rmurdough on October 24, 2010
Posted in: Asp.net, C#. Tagged: ajax, asp.net, c#, jquery, mono. Leave a Comment

Several months ago I was working on building a control library for one of my own Asp.net projects. I wanted the ability to refresh only a single control on the page with all its child controls. Being a fan of robustness of the jQuery framework and unimpressed with the performance of Asp.net Update Panels; I began to ponder a way to bridge these two technologies.  There was also a possibility of needing to run this Assembly from a web application running under Mono on a Linux server. Which at this point Mono only supported up to .Net 2.0, so this effectively removed Update Panels which were not supported under this release. (I apologize to anyone who considers me a heretic for these statements) So let me explain the solution I came up with, and feel free to improve on my idea and let me know what you come up with. As I was building server controls, all my controls inherited from System.Web.UI.WebControls.WebControl. Therefore it was logical to create the base control of my library which inherited WebControl and all my custom controls inherited from this control. This control would provide all the server logic for refreshing a single control on my web page. With introducing any new technology into a platform, it is important to make sure there will be no conflicts. Asp.net dynamically generates all element IDs rendered into a web page. But when you write your own Ajax calls, you will somehow have to uniquely identify the element being refreshed. Asp.net provides the CssClass member in its WebControl object and jQuery allows you to select an element by its unique CSS class. So began to think of a way I could use jQuery to asynchronously get the HTML for just that element with a single Ajax call and assign the returned HTML back to the element using jQuery all with a single javascript call. I found out this is extremely easy to do with Asp.net.

Here is the C# for this control:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SomeApp.Web.Core.Controls
{
    public class AjaxControl : WebControl
    {
        public AjaxControl (HtmlTextWriterTag tag) : base(tag)
        {

        }

        public override void RenderBeginTag (HtmlTextWriter writer)
        {
            if (Page.Request.QueryString.Get ("f") == "RenderAJAX" && Page.Request.QueryString.Get ("class") == this.CssClass)
            {
                Page.Response.Clear ();
            }
            else
            {
                base.RenderBeginTag (writer);
            }
        }
        public override void RenderEndTag (HtmlTextWriter writer)
        {
            if (Page.Request.QueryString.Get ("f") == "RenderAJAX" && Page.Request.QueryString.Get ("class") == this.CssClass)
            {
                Page.Response.Flush ();
                Page.Response.End ();
            }
            else
            {
                base.RenderEndTag (writer);
            }
        }
    }
}

Here is the JavaScript for this control.

function RefreshControl(cssClass)
{
    RefreshControl(cssClass, function () { });
}
function RefreshControl(cssClass, completeCallback)
{
    RefreshControl(css, completeCallback, {});
}
function RefreshControl(cssClass, completeCallback, arg)
{
    var url = document.URL + "?f=RenderAJAX&class=" + cssClass;
    $.get(url, arg, function (data) { RefreshControlComplete(data, cssClass); completeCallback(); });
}
function RefreshControlComplete(data, cssClass)
{
    $("." + cssClass).html(data);
}

In the JavaScript you will see I simply call the current page using the jQuery .get function with two arguments “f=RenderAjax” and “class”. With this request, the Asp.net page starts rendering each element on the page. You see in the C# code above that I override the RenderBeginTag and RenderEndTag functions. In those function overrides I simply test that argument “f” equals “RenderAjax” and that argument “class” equals the control’s CssClass member. If true then I clear the response before rendering our control, and end the response after our control is rendered. This simply forces Asp.net to only return the HTML for just this control. After this the RefreshControlComplete JavaScript function is called with the returned markup which jQuery assigns to the element with the class name provided. My functions also provide the ability to pass an argument along with the jQuery .get call in the form of a JavaScript array ({ “somevar” : “somedata” }). This data can then be accessed in the C# code via the Page.Request.QueryString object. This design can also be nicely integrated with the CSS style sheet by using the same control class name to define styles for that control. I know this make break a few rules by using CSS classes as unique identifiers, but if you come up with a better idea (which I know someone out there can), I would greatly appreciate hearing about it. Also don’t forget to reference the jQuery library in your example. In a later post I might write about how I intelligently store all my JavaScript in the assembly and host it on dynamically on demand whenever a control needs it.

I hope you find this useful, and thanks for reading!

Posts navigation

  • Recent Posts

    • My Thoughts on the Entity Framework
    • Singleton Design Pattern with C#
    • C# – Principles of the Data Model and Abstraction Layer
    • Compile JavaScript into C# Assembly & Dynamically Link with Server Control
    • Seamlessly Update Asp.net Server Control with jQuery
  • Recent Comments

    • Archives

      • February 2011
      • December 2010
      • November 2010
      • October 2010
    • Categories

      • Asp.net
      • C#
      • Design Patterns
    • Meta

      • Register
      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
    Proudly powered by WordPress Theme: Parament by Automattic.