Hello programmers,
I've just released the first full version of LinqToLfsWorld, which is a custom LINQ implementation used to query the LfsWorld Pubstat service through the .Net Framework.
If you're not quite sure what LINQ is or does, this is a good place to start. Essentially it allows you to write a Language INtegrated Query to transform one set of information into another (such as a url).
What this means is, using .Net and my library, you can query LfsWorld like so (in C#):
This query will produce the appropriate url to send to LfsWorld and retrieve the racer's stats for you.
All of the available actions have been implemented according to v1.4 of the pubstat service, and all of the required and optional parameters have been implemented.
Another goal of the project has been to implement a caching system where you can easily cache your responses to save hitting the pubstat service too often, without having to write special code yourself. It also prevents you from hitting the 5-second tarpit if you're not a premium member; of course you can switch this off if you are a premium member.
The library also allows you to use a custom configuration section to store all your LinqToLfsWorld settings in the application configuration file (app.config or web.config). Included with the release download (link below) is an example website which shows you how to use this configuration section.
For the moment, rather than pre-empt any questions that arise on how to use it, if you post here I can answer questions as they come up (assuming someone tries this out of course).
So here's the good stuff. The library comes as a DLL which you reference into your .Net project, and from there you can get access to the LfsWorldContext (the hub for making your queries). Also contained within the download archive is full class library documentation.
You can grab the library on the LinqToLfsWorld project site. Included with the download is an example website which shows you how to use the library to perform a hosts query and how to use the custom configuration section. All the source code is available from the Source Code tab on that site too. I'm also going to provide some code samples and issues with the library on my blog at stevescodingblog.co.uk over the next week or so.
Here's the code from the sample website included which gives you an idea of what you can do with it:
Links
I've just released the first full version of LinqToLfsWorld, which is a custom LINQ implementation used to query the LfsWorld Pubstat service through the .Net Framework.
If you're not quite sure what LINQ is or does, this is a good place to start. Essentially it allows you to write a Language INtegrated Query to transform one set of information into another (such as a url).
What this means is, using .Net and my library, you can query LfsWorld like so (in C#):
var query = from stats in LfsWorldContext.RacerStats
where stats.RacerName == "elkdanger"
select stats;
This query will produce the appropriate url to send to LfsWorld and retrieve the racer's stats for you.
All of the available actions have been implemented according to v1.4 of the pubstat service, and all of the required and optional parameters have been implemented.
Another goal of the project has been to implement a caching system where you can easily cache your responses to save hitting the pubstat service too often, without having to write special code yourself. It also prevents you from hitting the 5-second tarpit if you're not a premium member; of course you can switch this off if you are a premium member.
The library also allows you to use a custom configuration section to store all your LinqToLfsWorld settings in the application configuration file (app.config or web.config). Included with the release download (link below) is an example website which shows you how to use this configuration section.
For the moment, rather than pre-empt any questions that arise on how to use it, if you post here I can answer questions as they come up (assuming someone tries this out of course).
So here's the good stuff. The library comes as a DLL which you reference into your .Net project, and from there you can get access to the LfsWorldContext (the hub for making your queries). Also contained within the download archive is full class library documentation.
You can grab the library on the LinqToLfsWorld project site. Included with the download is an example website which shows you how to use the library to perform a hosts query and how to use the custom configuration section. All the source code is available from the Source Code tab on that site too. I'm also going to provide some code samples and issues with the library on my blog at stevescodingblog.co.uk over the next week or so.
Here's the code from the sample website included which gives you an idea of what you can do with it:
using (LfsWorldContext context = new LfsWorldContext())
{
// Make sure caching is enabled
context.CachingEnabled = true;
// Handle any "request made" events
context.RequestMade += new LfsRequestHandler(context_RequestMade);
/* Make an initial query to the hosts action */
var query = from host in context.Hosts
orderby host.RacerCount descending
select new
{
host.RacerCount,
host.TrackName,
host.HostName,
host.QualifyingMinutes,
host.Laps
};
// Refine further - only show active hosts
var list = query.Where(host => host.RacerCount > 0).ToList();
// Bind to the grid view
LfsHostsGridView.DataSource = list;
LfsHostsGridView.DataBind();
}
Links