避免解析数据库中的 xml 字段
我的第一个应用程序使用 XAF(DevExpress 框架)(它是一个 CMS)。有一个调度程序组件。 并且,它保存了像 xml 这样的事件的重复。例如:
<RecurrenceInfo Start="02/21/2012 09:00:00" End="02/28/2012 11:30:00" Id="e8507496-2be9-4bde-90a6-9eeea98fdc5a" Range="2" />
这是 Range 枚举(但还存在其他一些枚举):
public enum RecurrenceRange {
NoEndDate,
OccurrenceCount,
EndByDate
}
另外,我还有另一个应用程序(ASP.NET MVC)。我需要选择特定日期或时间段(今天、明天、当月等)的活动。
表中的问题将是 10000 条(例如)记录,然后我需要解析所有这些记录以查找请求日期的事件。我认为这会降低性能。
您看到什么解决方案?
我想执行以下操作:创建事件时(在 CMS 中),然后在表中添加一些持久字段并以编程方式填充它们。
如何更好地创建字段来存储这些数据?
还有一个问题。 例如,“事件”将在一周中的 5 点和 8 点进行。调度程序将在表中创建两条记录:
id EventName RecurrenceInfo Description //otherfields
1 event1 xml1 description1
2 event1 xml2 description1
问题在于调度程序又创建一条记录,并且除 RecurrenceInfo 之外的所有字段都相等。 我想再创建一个 id 列并为所有重复记录分配相同的值。
谢谢,抱歉我的英语。
I use XAF(DevExpress framework) for my first application (it's a CMS). There is a Scheduler component.
And, it saves recurrence of event like xml. For example:
<RecurrenceInfo Start="02/21/2012 09:00:00" End="02/28/2012 11:30:00" Id="e8507496-2be9-4bde-90a6-9eeea98fdc5a" Range="2" />
This is Range enum(but there are some other enum exist):
public enum RecurrenceRange {
NoEndDate,
OccurrenceCount,
EndByDate
}
Also, I have another application (ASP.NET MVC). I need select event for specific date or period(today, tomorrow, current month and other).
The pproblem in that in a table will be 10000(for example) records then I need to parse all of them to find event for request date. I think this is reduce perfomance.
What solution do you see?
I think to do the following: when event is created (in CMS) then add some persistent fields in the table and programmaticaly fill them.
How it is better to create fields for storage of this data?
And one more question.
For example, Event will go in a current of week at 5 o'clock and at 8 o'clock. The scheduler will create two records in the table:
id EventName RecurrenceInfo Description //otherfields
1 event1 xml1 description1
2 event1 xml2 description1
The problem in that the Scheduler create one more records and all fields equals except RecurrenceInfo.
I think to create one more id column and assign the same value all duplicate records.
Thanks and sorry my english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个 Xml 类型列并使用以下查询
You can make a Xml typed column and use the folowing query