Dynamic Formula Calculation
For a while now I have wanted to write a dynamic formula engine that could take a math equation sting and resolve it. While researching an unrelated topic I found a bit of code for a "FormulaGenerator" by Tiberiu Ionescu. The code is written for a single thread application, and it works wonderfully in that context. Unfortunately, I need something like it in a web application. I also want to be able to use variables within the formula for example :( 5 * x ) The Formula G...
[More]
Using an Object for an Id
It's not that uncommon to use an ID for a data object. However, sometimes more information is needed to uniquely identify an object than a number. In these cases is useful to use another object. It can contain an integer, guid, date created, created by, or even the date and time and object was modified. A good example of this would be a content management system. A given piece of content could have a content object ID, which would contain an ID, the day and time of the modification,...
[More]
Variable boxing and == vs. Equals
Let's take a moment and think about exactly how boxed variables work when checking to see if they are equal. Here is a little Console application to do a quick comparison of how the Equals function and == operator work. using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace VariableBoxEqualityTest
{
class Program
{
static void Main(string[] args)
{
int x = 1;
int y = 1;
test(x, y);
...
[More]
Extending the ASP.Net Security model to use rights: Cassini
I get a few messages about how the rights system fires many times per request and it is a lot of SQL traffic. Allow me to address this issue and introduce to your silent partner Cassini. Most developers, myself included, love being able to click the "play" icon (press F5 or select start debugging from the menu) and be able to debug their WebForms or MVC application on their local box. The catch here is this- the site you are debugging is not running on/being served by IIS. It'...
[More]
WebService Documentation: Using a custom Site Map
Not long ago I started working on changing the look and feel of the default WebService documentation that is generated by asp.net. While I demonstrated how to replace the default page template with a custom one I "glossed" over the details of what you can do with it. By using a custom Sitemap Provider you can create a dynamic Map of all of your WebServices methods. Please note I am not out to explain SiteMaps in this article. They list the pages in a site for use by some ...
[More]
WebService Documentation: Using a custom template
Web Services: they are an easy way to make information accessible or use information from some other site. For example, weather.gov's wsdl. The beauty of web services is that not all web services are .net and we don't have to care. Any web service that adheres to the w3's standards and that provides a wsdl we can easily use in asp.net. In order to help people understand how to consume the service; asp.net even gives us a nice page of generated documentation when someone opens the asm...
[More]
The woes of SourceForge.net and SVN
It's no secret, I use SourceForge.net to work on an open source project ObjectHelpDesk.net and most of the code, patterns and nick nacks that I write about come from that project. I also use TortoiseSVN coupled with VisualSVN to manage my source code. Recently, as part of the Generics, Interfaces, Providers and You series I choose to branch from the trunk and rewrite the projects provider model. When I was finished I attempted to merge them back together. Recently, I updated Tortoise and ...
[More]
Beyond Generics, Interfaces, Providers and You : IReadByParentId
Ok so in the Generics, Interfaces, Providers and You series, Part 1, Part 2, Part 3 & Part 4, we made a flexible system of interfaces to make working with a data access provider model easier. In Part 4, I listed some ideas where there was room for improvement in the interfaces/class that we made. If you have not read the series yet, go ahead and take a few minutes to read them; this post will not make much sense without it. So here it is, the IReadByParentId interface(s). Of course we...
[More]
Generics, Interfaces, Providers and You - Part 4: Building the Classes
Now that we have our interfaces we need to make some changes to our existing objects. Back in part 1 we defined an object tree for contact information. For this example, a 3rd parting marketing system is loading new contact information into our data store and management does not want anyone to delete data, but in a truely pointy hair boss fashion they want people to be able to update the data... First we will create the ContactInformationProviderRepository. We make a static Provide...
[More]
Generics, Interfaces, Providers and You - Part 3:IProviderCollection & IProviderRepository
In part 1 We talked about the web.config and the basic classes to get started with a provider model. Part 2 covered the interface for the data object and the Provider. Now in part 3 we will address the IProviderCollection and the IProviderRepository. Back in part one we added a provider collection to the generic provider repository by taking the provider collection as a generic parameter. Now we are going to define the ProviderCollection interfaces. They are going to be ICreateProvi...
[More]