LinqToLfsWorld 1.0.2

Rating: No reviews yet
Downloads: 272
Released: Jul 11, 2008
Updated: Jul 14, 2010 by elkdanger
Dev status: Stable Help Icon

Recommended Download

Application LinqToLfsWorld 1.0.2
application, 33K, uploaded Jul 11, 2008 - 79 downloads

Other Available Downloads

Documentation Library documentation
documentation, 429K, uploaded Jul 11, 2008 - 56 downloads
Example Demo website
example, 151K, uploaded Jul 11, 2008 - 77 downloads
Source Code Library source code
source code, 421K, uploaded Jul 11, 2008 - 60 downloads

Release Notes

An update to LinqToLfsWorld providing various bug fixes and improvements.

The main changes for this release are:
  • Implemented CarType constants
  • Implemented SteeringType constants
  • Implemented Circuit type constants
  • Added support for entity compatibility with WCF
  • Implemented Xml and Json serialization utility classes.
  • Implemented serialization extension methods to work on ILfsWorld entity and string classes.
  • Implemented a web page demonstrating JSON serialization using JQuery.
  • Added a quick serialization ajax demo to the demo website.
  • FIX: RacerStats wasn't stripping the colours from it's hostname properly

New query constants

In your LinqToLfsWorld queries which accept a car name, track ident or steering method as strings, you can now use a series of constants representing the possible values you can use. For example, instead of:

var query = lfswContext.HotLapLog.Where(log => log.SteeringType == "ms").First();

.. you can now use:

var query = lfswContext.HotLapLog.Where(log => log.SteeringType == SteeringTypes.Mouse).First();

Similarly for tracks and cars:

var query = from hlc in lfsContext.HotlapChart
where hlc.TrackIdent == CircuitTypes.BlackwoodGP
&& hlc.Car == CarTypes.XRG
&& hlc.SteeringMethod == SteeringTypes.Mouse
select hlc;

Hopefully this will make your queries less error prone and more readable, especially when circuits are concerned.

Serialization

To serialize a LinqToLfsWorld entity (such as a WorldRecord or RacerStats instance), simply call ToXml() or ToJson() methods on it. This will return a string containing Xml or Json respectively. To convert this string back to an entity, call EntityFromXml<> or EntityFromJson<> methods, like so:
WorldRecord wr = jsonString.EntityFromJson<WorldRecord>();
All these extension methods are available by importing the LinqToLfsWorld.Extensions namespace. Note that any string would then have the entity serialization methods on it. However, if you try to use these methods on a string which doesn't contain Json or Xml data representing a LfsWorld entity, an exception will be thrown.

If you don't want to use the extension methods provided, you can always use the entity serializers themselves, which are pretty simple in themselves to use:
RacerFuel fuel = new RacerFuel();
XmlSerializer<RacerFuel> s = new XmlSerializer<RacerFuel>();
string serialized = s.Serialize(fuel);
RacerFuel fuelOut = s.Deserialize(serialized);

The above will serialize an entity to Xml. Json serialization is very similar - just use the JsonSerializer in place of the XmlSerializer!
The demo website (attached now as a separate download to the main library) demonstrates this serialization in action by fetching the data through an Ajax call on the page. The entities support WCF too, so you could retrieve this data by setting up a WCF Service to expose this data quite easily.

Reviews for this release

No reviews yet for this release.