Question

I am trying to store recurrence event information into a database. I want to store recorder into a a Database table with the following fields.

  • Start Date - Datetime
  • End Date - DateTime
  • RecurrencePattern - string

I wanted to see if there was already some standard format to store the RecurrencePattern in and an associated library to parse out this string recurrenPattern and a start / end date and convert into a set of dates. I see this exists for javascript so maybe a port to C# or something similar ?

To serialize the event to the db, do i really have to create a new iCalendar and serialize a calendar for each event ? Would there be a way to simply serialize the event by itself to the db using this library?

Updated question regarding DDay.iCal per Jon Skeet's answer:

As per jon skeet's suggestion, i started looking at DDay.iCal and it looks very good. My one follow up question is that it seems to only read a full ical (ics) at a time from disk in the example. In my case i am just storing events independently in a database table. What would be the best way:

  1. To read in these events from the DB
  2. To save independent events to the DB (each event is a row in a db table)

using this library?

Was it helpful?

Solution

There's the DDay.iCal library. Can't say I've used it, but that's the one that a quick search for iCalendar and C# found... (iCalendar or RFC 5545 is where that Javascript format comes from.)

In my experience with these things on other platforms, recurrences get complicated really quickly. If you can limit your scope from the start, you'll have a much better change of success IMO.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top