本文整理汇总了C#中IProject.GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C# IProject.GetEntity方法的具体用法?C# IProject.GetEntity怎么用?C# IProject.GetEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProject
的用法示例。
在下文中一共展示了IProject.GetEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateExceptionInfoEntity
private static void CreateExceptionInfoEntity( IProject project )
{
EntityClass exception = new EntityClass( "ExceptionInfo", "public" );
EntityField id = new EntityField( "id" );
id.IsPrimaryKey = true;
id.IsPreview = true;
id.Type = intType;
EntityField name = new EntityField( "name" );
name.MaxSize = 15000;
name.IsRequired = true;
name.Type = stringType;
EntityField message = new EntityField( "message" );
message.Represents = true;
message.IsPreview = true;
message.IsRequired = true;
message.MaxSize = 15000;
message.Type = stringType;
EntityField date = new EntityField( "date" );
date.Type = dateTimeType;
EntityField exceptions = new EntityField( "exceptions" );
exceptions.Mult = Multiplicity.OneToMany;
exceptions.Type = exception;
EntityField principal = null;
principal = new EntityField( "principal" );
principal.Mult = Multiplicity.ManyToOne;
EntityClass principalEntity = project.GetEntity( "Principal" );
principalEntity.Fields.Add( exceptions );
principal.Type = principalEntity;
EntityField url = new EntityField( "url" );
url.Regex.Add( "$http://" );
url.MaxSize = 15000;
url.Type = stringType;
EntityField stackTrace = new EntityField( "stackTrace" );
stackTrace.MaxSize = 15000;
stackTrace.IsRequired = true;
stackTrace.Type = stringType;
exception.AddField( id );
exception.AddField( name );
exception.AddField( message );
exception.AddField( date );
exception.AddField( principal );
exception.AddField( url );
exception.AddField( stackTrace );
project.Model.Add( exception );
}
示例2: CreatePrincipalEntity
private static void CreatePrincipalEntity( IProject project )
{
EntityClass principal = project.GetEntity( "Principal" );
if( principal == null ) {
principal = new EntityClass( "Principal", "public" );
EntityField id = new EntityField( "id" );
id.IsPrimaryKey = true;
id.Type = intType;
id.IsPreview = true;
principal.AddField( id );
project.Model.Add( principal );
}
principal.Lazy = true;
if( !principal.HasField( "name" ) ) {
EntityField name = new EntityField( "name" );
name.MaxSize = 200;
name.IsRequired = true;
name.IsPreview = true;
name.Represents = true;
name.Type = stringType;
principal.AddField( name );
}
if( !principal.HasField( "password" ) ) {
EntityField password = new EntityField( "password" );
password.MaxSize = 50;
password.IsRequired = true;
password.Type = stringType;
password.Secret = true;
principal.AddField( password );
}
if( !principal.HasField( "email" ) ) {
EntityField mail = new EntityField( "email" );
mail.MaxSize = 200;
mail.IsPreview = true;
mail.IsRequired = true;
mail.Type = stringType;
//mail.Regex.Add(
mail.Unique = true;
principal.AddField( mail );
}
if( !principal.HasField( "ip" ) ) {
EntityField ip = new EntityField( "ip" );
ip.MaxSize = 15;
ip.Type = stringType;
ip.IsPreview = true;
//ip.Regex.Add(
principal.AddField( ip );
}
if( !principal.HasField( "registDate" ) ) {
EntityField registDate = new EntityField( "registDate" );
registDate.IsRequired = true;
registDate.Type = dateTimeType;
//principal.Regex.Add(
principal.AddField( registDate );
}
if( !principal.HasField( "lastLogin" ) ) {
EntityField lastLogin = new EntityField( "lastLogin" );
lastLogin.IsRequired = true;
lastLogin.Type = dateTimeType;
//principal.Regex.Add(
principal.AddField( lastLogin );
}
if( !principal.HasField( "approved" ) ) {
EntityField approved = new EntityField( "approved" );
approved.IsRequired = true;
approved.Type = boolType;
approved.Default = false;
principal.AddField( approved );
}
if( !principal.HasField( "isOnline" ) ) {
EntityField isOnline = new EntityField( "isOnline" );
isOnline.Type = boolType;
isOnline.Default = false;
principal.AddField( isOnline );
}
if( !principal.HasField( "locked" ) ) {
EntityField locked = new EntityField( "locked" );
locked.Type = boolType;
locked.Default = false;
principal.AddField( locked );
}
if( !principal.HasField( "locale" ) ) {
EntityField locale = new EntityField( "locale" );
locale.Type = stringType;
locale.IsRequired = true;
locale.MaxSize = 6;
//.........这里部分代码省略.........