当前位置: 首页>>代码示例>>C#>>正文


C# IProject.GetEntity方法代码示例

本文整理汇总了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 );
        }
开发者ID:zi-yu,项目名称:midgard,代码行数:55,代码来源:DefaultEntities.cs

示例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;
//.........这里部分代码省略.........
开发者ID:zi-yu,项目名称:midgard,代码行数:101,代码来源:DefaultEntities.cs


注:本文中的IProject.GetEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。