BotSharp/Bot.Rasa/Intents/IntentExpression.cs

38 lines
952 B
C#
Raw Normal View History

2017-12-30 20:26:35 +00:00
using Bot.Rasa.Expressions;
2017-12-18 13:31:15 +00:00
using EntityFrameworkCore.BootKit;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
namespace Bot.Rasa.Intents
{
2017-12-30 20:26:35 +00:00
[Table("Bot_IntentExpression")]
public class IntentExpression : DbRecord, IDbRecord
2017-12-18 13:31:15 +00:00
{
2017-12-30 20:26:35 +00:00
public IntentExpression()
{
Entities = new List<EntitiyOfSpeech>();
}
2017-12-18 13:31:15 +00:00
[Required]
[StringLength(36)]
public String IntentId { get; set; }
[Required]
[MaxLength(128)]
public String Text { get; set; }
2017-12-30 20:26:35 +00:00
[ForeignKey("ExpressionId")]
public List<EntitiyOfSpeech> Entities { get; set; }
public bool IsExist(Database dc)
2017-12-18 13:31:15 +00:00
{
2017-12-30 20:26:35 +00:00
return dc.Table<IntentExpression>().Any(x => x.IntentId == IntentId && x.Text == Text);
2017-12-18 13:31:15 +00:00
}
}
}