示例#1
0
        public override void Init(IProject project, IDependencyManager dependencies, IBuildAggregator aggregator)
        {
            base.Init(project, dependencies, aggregator);
            Model model = project.Model;

            EntityClass quotes = new EntityClass();

            quotes.Name       = "QuoteOfTheDay";
            quotes.Visibility = "public";

            EntityField id = new EntityField();

            id.Name         = "id";
            id.IsPreview    = true;
            id.IsPrimaryKey = true;
            id.Type         = IntrinsicTypes.Create("System.Int32");
            quotes.Fields.Add(id);

            EntityField quote = new EntityField();

            quote.Name       = "quote";
            quote.Represents = true;
            quote.IsPreview  = true;
            quote.Type       = IntrinsicTypes.Create("System.String");
            quote.IsRequired = true;
            quote.MaxSize    = 1000;
            quotes.Fields.Add(quote);

            model.Add(quotes);
        }
示例#2
0
        private EntityClass CreateLogger()
        {
            Entity intEntity      = IntrinsicTypes.Create("System.Int32");
            Entity stringEntity   = IntrinsicTypes.Create("System.String");
            Entity dateTimeEntity = IntrinsicTypes.Create("System.DateTime");

            EntityClass logger = new EntityClass();

            logger.Name       = "RequestLogger";
            logger.Visibility = "public";

            EntityField field = new EntityField();

            field.Name         = "id";
            field.IsPrimaryKey = true;
            field.IsPreview    = true;
            field.Type         = intEntity;
            logger.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "url";
            field.IsPreview  = true;
            field.Represents = true;
            field.Type       = stringEntity;
            field.MaxSize    = 1000;
            logger.Fields.Add(field);

            field           = new EntityField();
            field.Name      = "date";
            field.IsPreview = true;
            field.Type      = dateTimeEntity;
            logger.Fields.Add(field);

            field           = new EntityField();
            field.Name      = "requestTime";
            field.IsPreview = true;
            field.Type      = intEntity;
            logger.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "referrer";
            field.Type       = stringEntity;
            field.IsRequired = false;
            field.MaxSize    = 1000;
            logger.Fields.Add(field);

            field         = new EntityField();
            field.Name    = "ip";
            field.Type    = stringEntity;
            field.MaxSize = 15;
            logger.Fields.Add(field);

            field         = new EntityField();
            field.Name    = "userAgent";
            field.Type    = stringEntity;
            field.MaxSize = 1500;
            logger.Fields.Add(field);

            return(logger);
        }
示例#3
0
        private static EntityInterface GetInterface()
        {
            /** IPerson Definition **/
            EntityInterface iPerson = new EntityInterface();

            iPerson.Name       = "IPerson";
            iPerson.Visibility = "public";

            EntityMethod getDescription = new EntityMethod();

            getDescription.Name = "GetPerson";
            EntityParameter paramRet = new EntityParameter();

            paramRet.IsReturn = true;
            paramRet.Type     = IntrinsicTypes.Create("System.String");
            EntityParameter param = new EntityParameter();

            param.IsReturn = false;
            param.Type     = IntrinsicTypes.Create("System.Int32");
            param.Name     = "id";

            getDescription.ReturnEntity = paramRet;
            List <EntityParameter> parames = new List <EntityParameter>();

            parames.Add(param);
            getDescription.Parameters = parames;

            EntityMethod init = new EntityMethod();

            init.Name = "Init";

            EntityMethod set = new EntityMethod();

            set.Name = "SetData";
            EntityParameter param1 = new EntityParameter();

            param1.IsReturn = true;
            param1.Type     = IntrinsicTypes.Create("System.String");
            param1.Name     = "nome";
            EntityParameter param2 = new EntityParameter();

            param2.IsReturn = false;
            param2.Type     = IntrinsicTypes.Create("System.Boolean");
            param2.Name     = "isMale";
            List <EntityParameter> parames2 = new List <EntityParameter>();

            parames2.Add(param1);
            parames2.Add(param2);
            set.Parameters = parames2;

            iPerson.Methods.Add(getDescription);
            iPerson.Methods.Add(init);
            iPerson.Methods.Add(set);
            return(iPerson);
        }
示例#4
0
        private static void BuildSmsTestModel()
        {
            EntityField field = null;

            /** User **/
            EntityClass user = new EntityClass();

            user.Name       = "Principal";
            user.Visibility = "public";

            field              = new EntityField();
            field.Name         = "Id";
            field.IsPrimaryKey = true;
            field.Type         = new Int();
            user.Fields.Add(field);

            /** IDescription Definition **/
            EntityInterface iDescription = new EntityInterface();

            iDescription.Name       = "IDescription";
            iDescription.Visibility = "public";
            EntityMethod getDescription = new EntityMethod();

            getDescription.Name = "GetDescription";
            EntityParameter param = new EntityParameter();

            param.IsReturn = true;
            param.Type     = IntrinsicTypes.Create("System.String");
            getDescription.ReturnEntity = param;
            iDescription.Methods.Add(getDescription);

            /** Category Definition **/

            EntityClass category = new EntityClass();

            category.Name       = "Category";
            category.Visibility = "public";
            //category.Interfaces.Add(iDescription);

            field              = new EntityField();
            field.Name         = "Id";
            field.IsPrimaryKey = true;
            field.Type         = new Int();
            category.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "Description";
            field.IsRequired = true;
            field.MaxSize    = 500;
            field.Type       = new Loki.DataRepresentation.IntrinsicEntities.String();
            category.Fields.Add(field);

            /** Sms Definition **/

            EntityClass message = new EntityClass();

            message.Name       = "SmsBase";
            message.IsAbstract = true;
            message.Visibility = "public";
            //message.Interfaces.Add(iDescription);

            field              = new EntityField();
            field.Name         = "Id";
            field.IsPrimaryKey = true;
            field.Type         = new Int();
            message.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "Description";
            field.IsRequired = true;
            field.MaxSize    = 500;
            field.Default    = "No Description";
            field.Type       = new Loki.DataRepresentation.IntrinsicEntities.String();
            message.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "Category";
            field.Type       = category;
            field.Mult       = Multiplicity.ManyToOne;
            field.IsRequired = true;
            message.Fields.Add(field);

            field            = new EntityField();
            field.Name       = "Principal";
            field.Type       = user;
            field.Mult       = Multiplicity.ManyToOne;
            field.IsRequired = true;
            message.Fields.Add(field);

            field          = new EntityField();
            field.Name     = "Messages";
            field.Type     = message;
            field.Mult     = Multiplicity.OneToMany;
            field.InfoOnly = true;
            user.Fields.Add(field);

            field          = new EntityField();
            field.Name     = "Messages";
            field.Type     = message;
            field.InfoOnly = true;
            field.Mult     = Multiplicity.OneToMany;
            category.Fields.Add(field);

            /** ImageSms **/
            EntityClass imageSms = new EntityClass();

            imageSms.Name       = "ImageSms";
            imageSms.Visibility = "public";
            imageSms.Parent     = message;

            field            = new EntityField();
            field.Name       = "ImageUrl";
            field.Type       = new Loki.DataRepresentation.IntrinsicEntities.String();
            field.IsRequired = true;
            field.Default    = "#";
            imageSms.Fields.Add(field);

            /** TextSms **/
            EntityClass textSms = new EntityClass();

            textSms.Name       = "TextSms";
            textSms.Visibility = "public";
            textSms.Parent     = message;

            field            = new EntityField();
            field.Name       = "Text";
            field.Type       = new Loki.DataRepresentation.IntrinsicEntities.String();
            field.IsRequired = true;
            field.Default    = "Empty";
            textSms.Fields.Add(field);

            /** Setting up project **/
            Model list = new Model();

            list.Add(category);
            list.Add(iDescription);
            list.Add(user);
            list.Add(message);
            list.Add(imageSms);
            list.Add(textSms);
            smsTestModel.Model = list;
        }