Sample Data

2 posts, 1 answers
  1. Lone
    Lone avatar
    15 posts
    Member since:
    Mar 2009

    Posted 20 Feb 2010 Link to this post

    This attracted me the most since my application will rely heavily on data and it is hard to manually code test data for a program prototype. However, I do not see any code samples depicting how I would go about using or implementing this sample data. Can you gove me a few guidelines.
  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 22 Feb 2010 Link to this post

    Hi Lone,

    You can use the AdventureWorks or Chinook sample databases provided from Microsoft. They provide quite realistic sample data, i.e. there are tables with huge amounts of records, there are master-details relationships, etc. In other words, they try to cover almost all real-life project scenarios that could exist. Of course, sample data is sample data, there might be real-life project which are much more complex.

    Alternatively you can create dummy data in memory on the fly in any possible way that you need. There are no a rules or guidelines on how to create sample data (or examples).

    This is just .NET source code. You can create sample data in infinite number of ways, for example:

    public static IEnumerable<Customer> GetSampleData(int count)
    {
        return from index in Enumerable.Range(1, count)
               select new Customer
                          {
                              Age = index,
                              Boolean = Convert.ToBoolean(index % 2),
                              Name = "Customer " + index,
                              JobCode = index,
                              RegistrationDate = DateTime.Today
                          };
    }

    Or anything else that you might need.

    I hope this helps.

    Best wishes,
    Ross
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top