BotSharp/BotSharp.Core/Intents/IntentExpression.cs

34 lines
860 B
C#
Raw Normal View History

2018-03-28 22:08:49 +00:00
using BotSharp.Core.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;
2018-03-28 22:08:49 +00:00
namespace BotSharp.Core.Intents
2017-12-18 13:31:15 +00:00
{
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()
{
Data = new List<IntentExpressionPart>();
2017-12-30 20:26:35 +00:00
}
2017-12-18 13:31:15 +00:00
[Required]
[StringLength(36)]
public String IntentId { get; set; }
2017-12-30 20:26:35 +00:00
[ForeignKey("ExpressionId")]
public List<IntentExpressionPart> Data { get; set; }
2017-12-30 20:26:35 +00:00
public bool IsExist(Database dc)
2017-12-18 13:31:15 +00:00
{
return dc.Table<IntentExpression>().Any(x => x.IntentId == IntentId);
2017-12-18 13:31:15 +00:00
}
}
}