Exemple #1
0
        public void TestSubSchema()
        {
            var subSchema = new ObjectSchema()
                            .WithRequiredProperty("Id", "String")
                            .WithRequiredProperty("FLOATFIELD", "Single")
                            .WithOptionalProperty("nullproperty", "Object");

            var schema = new ObjectSchema()
                         .WithRequiredProperty("intField", "Int32")
                         .WithRequiredProperty("longField", "Int64")
                         .WithRequiredProperty("floatField", "Float")
                         .WithRequiredProperty("doubleField", "Double")
                         .WithRequiredProperty("StringProperty", "String")
                         .WithOptionalProperty("NullProperty", "Object")
                         .WithRequiredProperty("IntArrayProperty", "Int32[]")
                         .WithRequiredProperty("StringListProperty", "List`1")
                         .WithRequiredProperty("MapProperty", "Dictionary`2")
                         .WithRequiredProperty("SubObjectProperty", subSchema)
                         .WithRequiredProperty("SubArrayProperty", "TestSubObject[]")
                         .WithRequiredProperty("EnumIntProperty", "TestEnumInt")
                         .WithRequiredProperty("EnumStringProperty", "TestEnumString");

            var obj     = new TestObject();
            var results = schema.Validate(obj);

            Assert.Empty(results);
        }
        static PromotionSkuListModel()
        {
            _schema = new ObjectSchema <PromotionSkuListModel>();
            _schema.AddField(x => x.spu, "spu");

            _schema.AddField(x => x.Sku, "Sku");

            _schema.AddField(x => x.Name, "Name");

            _schema.AddField(x => x.MainValue, "MainValue");

            _schema.AddField(x => x.SubValue, "SubValue");

            _schema.AddField(x => x.Price, "Price");

            _schema.AddField(x => x.skuProStatus, "skuProStatus");

            _schema.AddField(x => x.PromotionPrice, "PromotionPrice");

            _schema.AddField(x => x.PromotionRate, "PromotionRate");

            _schema.AddField(x => x.PromotionId, "PromotionId");

            _schema.AddField(x => x.ImagePath, "ImagePath");
            _schema.Compile();
        }
 public Metadata(TableKey tableKey, IRealmObjectHelper helper, IDictionary <string, IntPtr> propertyIndices, ObjectSchema schema)
 {
     TableKey        = tableKey;
     Helper          = helper;
     PropertyIndices = new ReadOnlyDictionary <string, IntPtr>(propertyIndices);
     Schema          = schema;
 }
        public void TestJsonSchema()
        {
            var subSchema = new ObjectSchema()
                            .WithRequiredProperty("Id", "string")
                            .WithRequiredProperty("FLOATFIELD", "float")
                            .WithOptionalProperty("nullproperty", "object");

            var schema = new ObjectSchema()
                         .WithRequiredProperty("intField", "int")
                         .WithRequiredProperty("StringProperty", "string")
                         .WithOptionalProperty("NullProperty", "object")
                         .WithRequiredProperty("IntArrayProperty", new ArraySchema("int"))
                         .WithRequiredProperty("StringListProperty", new ArraySchema("string"))
                         .WithRequiredProperty("MapProperty", new MapSchema("string", "int"))
                         .WithRequiredProperty("SubObjectProperty", subSchema)
                         .WithRequiredProperty("SubArrayProperty", new ArraySchema(subSchema));

            var obj     = new TestObject();
            var json    = JsonConverter.ToJson(obj);
            var jsonObj = JsonConverter.FromJson(json);

            var results = schema.Validate(jsonObj);

            Assert.Equal(0, results.Count);
        }
Exemple #5
0
        static MyHL()
        {
            _schema = new ObjectSchema <MyHL>();

            _schema.AddField(x => x.userId, "userId");

            _schema.AddField(x => x.countHL, "countHL");

            _schema.AddField(x => x.freezeHL, "freezeHL");

            _schema.AddField(x => x.usableHL, "usableHL");

            _schema.AddField(x => x.Direction, "Direction");

            _schema.AddField(x => x.ChangedHuoLi, "ChangedHuoLi");

            _schema.AddField(x => x.Description, "Description");

            _schema.AddField(x => x.TotalRecord, "TotalRecord");

            _schema.AddField(x => x.CurrentHuoLi, "CurrentHuoLi");

            _schema.AddField(x => x.CreateTime, "CreateTime");

            _schema.AddField(x => x.OriginalHuoLi, "OriginalHuoLi");

            _schema.AddField(x => x.TradeCode, "TradeCode");

            _schema.AddField(x => x.addTime, "addTime");
            _schema.Compile();
        }
Exemple #6
0
        public void TestArrayAndMapSchema()
        {
            var subSchema = new ObjectSchema()
                            .WithRequiredProperty("Id", "String")
                            .WithRequiredProperty("FLOATFIELD", "Single")
                            .WithOptionalProperty("nullproperty", "Object");

            var schema = new ObjectSchema()
                         .WithRequiredProperty("intField", "Int32")
                         .WithRequiredProperty("longField", "Int64")
                         .WithRequiredProperty("floatField", "Float")
                         .WithRequiredProperty("doubleField", "Double")
                         .WithRequiredProperty("StringProperty", "String")
                         .WithOptionalProperty("NullProperty", "Object")
                         .WithRequiredProperty("IntArrayProperty", new ArraySchema("Int32"))
                         .WithRequiredProperty("StringListProperty", new ArraySchema("String"))
                         .WithRequiredProperty("MapProperty", new MapSchema("String", "Int32"))
                         .WithRequiredProperty("SubObjectProperty", subSchema)
                         .WithRequiredProperty("SubArrayProperty", new ArraySchema(subSchema))
                         .WithRequiredProperty("EnumIntProperty", "TestEnumInt")
                         .WithRequiredProperty("EnumStringProperty", "TestEnumString");

            var obj     = new TestObject();
            var results = schema.Validate(obj);

            Assert.Equal(0, results.Count);
        }
Exemple #7
0
        public void TestRequiredProperties()
        {
            var schema = new ObjectSchema()
                         .WithRequiredProperty("intField", null)
                         .WithRequiredProperty("longField", null)
                         .WithRequiredProperty("floatField", null)
                         .WithRequiredProperty("doubleField", null)
                         .WithRequiredProperty("StringProperty", null)
                         .WithRequiredProperty("NullProperty", null)
                         .WithRequiredProperty("IntArrayProperty", null)
                         .WithRequiredProperty("StringListProperty", null)
                         .WithRequiredProperty("MapProperty", null)
                         .WithRequiredProperty("SubObjectProperty", null)
                         .WithRequiredProperty("SubArrayProperty", null)
                         .WithRequiredProperty("EnumIntProperty", null)
                         .WithRequiredProperty("EnumStringProperty", null);

            var obj = new TestObject {
                SubArrayProperty = null
            };

            var results = schema.Validate(obj);

            Assert.Equal(2, results.Count);
        }
        public static void ProcessContentFilter(string contentFilter, int contentFilterLCID, PSCmdlet cmdlet, IFilterBuilderHelper mapper, out RestrictionData restriction, out string normalizedFilter)
        {
            Exception ex = null;

            try
            {
                QueryParser queryParser  = new QueryParser(contentFilter, ObjectSchema.GetInstance <ContentFilterSchema>(), QueryParser.Capabilities.All, (cmdlet != null) ? new QueryParser.EvaluateVariableDelegate(cmdlet.GetVariableValue) : null, new QueryParser.ConvertValueFromStringDelegate(ContentFilterBuilder.ConvertValueFromString));
                QueryFilter parseTree    = queryParser.ParseTree;
                Restriction restriction2 = ContentFilterBuilder.BuildRestriction(parseTree, mapper);
                restriction      = RestrictionData.GetRestrictionData(restriction2);
                restriction.LCID = contentFilterLCID;
                normalizedFilter = parseTree.GenerateInfixString(FilterLanguage.Monad);
                return;
            }
            catch (InvalidCastException ex2)
            {
                ex = ex2;
            }
            catch (ParsingException ex3)
            {
                ex = ex3;
            }
            catch (ArgumentOutOfRangeException ex4)
            {
                ex = ex4;
            }
            throw new InvalidContentFilterPermanentException(ex.Message, ex);
        }
        internal override QueryResponse GetExchangeDiagnosticsInfoData(DiagnosableParameters arguments)
        {
            QueryResponse result;

            try
            {
                if (this.databaseManager == null)
                {
                    result = QueryResponse.CreateError("DatabaseManager is not start yet, or not registered for online diagnostics");
                }
                else if (string.IsNullOrEmpty(arguments.Argument))
                {
                    StringBuilder sb = new StringBuilder();
                    this.dispatcher.Keys.ToList <string>().ForEach(delegate(string x)
                    {
                        sb.AppendFormat(" {0}", x);
                    });
                    result = QueryResponse.CreateError("Please specify argument paramter, supported objectClass:" + sb.ToString());
                }
                else
                {
                    QueryParser queryParser = new QueryParser(arguments.Argument, ObjectSchema.GetInstance <QueryableObjectSchema>(), QueryParser.Capabilities.All, null, new QueryParser.ConvertValueFromStringDelegate(QueryParserUtils.ConvertValueFromString));
                    QueryFilter filter      = queryParser.ParseTree;
                    filter = QueryFilter.SimplifyFilter(filter);
                    result = this.ExecuteQuery(filter);
                }
            }
            catch (ArgumentException ex)
            {
                result = QueryResponse.CreateError(ex.ToString());
            }
            return(result);
        }
Exemple #10
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            if (this.Identity != null)
            {
                this.Server = ServerIdParameter.Parse(this.Identity.Server);
            }
            if (this.Server == null || string.Compare(this.Server.ToString(), "localhost", true) == 0)
            {
                this.Server = new ServerIdParameter();
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(base.CurrentOrganizationId), 263, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\Queueviewer\\QueueTasks.cs");
            ServerIdParameter     server = this.Server;
            Server           entry       = (Server)this.GetDataObject <Server>(server, tenantOrTopologyConfigurationSession, null, null, Strings.ErrorServerNotFound(server.ToString()), Strings.ErrorServerNotUnique(server.ToString()));
            ADScopeException ex;

            if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(entry, true, out ex))
            {
                base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope((this.Identity != null) ? this.Identity.ToString() : this.Server.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Context, this.Identity);
            }
            if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server))
            {
                this.InitializeInnerFilter <QueueInfoSchema>(this.Filter, ObjectSchema.GetInstance <QueueInfoSchema>());
            }
        }
Exemple #11
0
        static TeamInfoEntity()
        {
            _schema = new ObjectSchema <TeamInfoEntity>();

            _schema.AddField(x => x.ID, "ID");

            _schema.AddField(x => x.TeamCode, "TeamCode");

            _schema.AddField(x => x.Sku, "sku");

            _schema.AddField(x => x.TeamStatus, "TeamStatus");

            _schema.AddField(x => x.StartTime, "StartTime");

            _schema.AddField(x => x.EndTime, "EndTime");

            _schema.AddField(x => x.UserID, "UserID");

            _schema.AddField(x => x.TeamNumbers, "TeamNumbers");

            _schema.AddField(x => x.CreatTime, "CreatTime");

            _schema.AddField(x => x.SuccTeamTime, "SuccTeamTime");

            _schema.AddField(x => x.PromotionId, "PromotionId");

            _schema.Compile();
        }
        static BerserkProductEntity()
        {
            _schema = new ObjectSchema <BerserkProductEntity>();
            _schema.AddField(x => x.Name, "Name");

            _schema.AddField(x => x.Unit, "Unit");

            _schema.AddField(x => x.ImagePath, "ImagePath");

            _schema.AddField(x => x.DiscountPrice, "DiscountPrice");

            _schema.AddField(x => x.DiscountRate, "DiscountRate");

            _schema.AddField(x => x.MinPrice, "MinPrice");

            _schema.AddField(x => x.Spu, "Spu");

            _schema.AddField(x => x.Id, "Id");

            _schema.AddField(x => x.MinForOrder, "MinForOrder");

            _schema.AddField(x => x.ForOrderQty, "ForOrderQty");

            _schema.Compile();
        }
        public async Task BaseTestCreateColumnForAllTypes()
        {
            var mapper      = new TypeMapper();
            var jumboSchema = new ObjectSchema()
            {
                Name = this.BaselineSchema.Name
            };

            jumboSchema.Columns["Id"] = new ColumnSchema()
            {
                Name     = "Id",
                KeyIndex = 1,
                SqlType  = SqlDbType.Int
            };
            foreach (var type in mapper.Mappings.SelectMany(m => m.Value))
            {
                string name = $"Column{type.SqlType.ToString()}";
                jumboSchema.Columns[name] = new ColumnSchema()
                {
                    Name      = name,
                    Nullable  = false,
                    SqlType   = type.SqlType,
                    MaxLength = type.HasLength ? (int?)100 : null
                };
            }

            await this.Manager.CreateObject(this.Connection, jumboSchema);

            var fetchedSchema = await this.Manager.GetSchema(this.Connection, jumboSchema.Name);

            Assert.IsNotNull(fetchedSchema, "Existant schema should return non-null");
            SchemaAssertions.AssertObjectSchemasEqual(jumboSchema, fetchedSchema);
        }
Exemple #14
0
        // Token: 0x060004F0 RID: 1264 RVA: 0x0001C40C File Offset: 0x0001A60C
        private QueryFilter ParseFilter()
        {
            ObjectSchema instance = ObjectSchema.GetInstance <MailboxProvisioningAttributesSchema>();
            Exception    ex       = null;
            QueryFilter  result   = null;

            try
            {
                QueryParser queryParser = new QueryParser(this.Value, instance, QueryParser.Capabilities.All, null, new QueryParser.ConvertValueFromStringDelegate(MailboxProvisioningConstraint.ConvertValueFromString));
                result = queryParser.ParseTree;
            }
            catch (ParsingNonFilterablePropertyException ex2)
            {
                ex = ex2;
            }
            catch (ParsingException ex3)
            {
                ex = ex3;
            }
            catch (ArgumentOutOfRangeException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                throw new InvalidMailboxProvisioningConstraintException(ex.Message, ex);
            }
            return(result);
        }
        static ProductAuditingListModel()
        {
            _schema = new ObjectSchema <ProductAuditingListModel>();
            _schema.AddField(x => x.Spu, "Spu");

            _schema.AddField(x => x.ProductName, "ProductName");

            _schema.AddField(x => x.SupplierName, "SupplierName");

            _schema.AddField(x => x.Createtime, "Createtime");

            _schema.AddField(x => x.SalesTerritory, "SalesTerritory");

            _schema.AddField(x => x.DataSource, "DataSource");

            _schema.AddField(x => x.Sku, "Sku");

            _schema.AddField(x => x.ReportStatus, "ReportStatus");

            _schema.AddField(x => x.CategoryName, "CategoryName");

            _schema.AddField(x => x.Status, "Status");

            _schema.AddField(x => x.InventoryStatus, "InventoryStatus");

            _schema.AddField(x => x.IsOnSaled, "IsOnSaled");

            _schema.AddField(x => x.QTY, "QTY");

            _schema.AddField(x => x.MinForOrder, "MinForOrder");

            _schema.AddField(x => x.SkuOrderQuantity, "SkuOrderQuantity");
            _schema.Compile();
        }
        static IndexModulesProductEntity()
        {
            _schema = new ObjectSchema <IndexModulesProductEntity>();

            _schema.AddField(x => x.Spu, "Spu");

            _schema.AddField(x => x.Name, "Name");

            _schema.AddField(x => x.CategoryId, "CategoryId");

            _schema.AddField(x => x.CategoryName, "CategoryName");

            _schema.AddField(x => x.IndexValue, "IndexValue");

            _schema.AddField(x => x.SortValue, "SortValue");

            _schema.AddField(x => x.DiscountPrice, "DiscountPrice");

            _schema.AddField(x => x.DiscountRate, "DiscountRate");

            _schema.AddField(x => x.MinPrice, "MinPrice");

            _schema.AddField(x => x.ImagePath, "ImagePath");

            _schema.AddField(x => x.Unit, "Unit");

            _schema.AddField(x => x.Qty, "Qty");

            _schema.Compile();
        }
Exemple #17
0
        public ObjectMapper(ObjectSchema <T> schema)
        {
            _schema = schema;
            if (!_schema.IsReadonly)
            {
                _schema.Compile();
            }

            _propertyValues = new IPropertyValue <T> [schema.FieldMaps().Count];

            foreach (FieldMap <T> fieldMap in schema.FieldMaps())
            {
                _propertyValues[schema.IndexOf(fieldMap.Field)] = new PropertyValueForLambda <T>(fieldMap.Expression);
            }
            //

            if (this._schema.Name == null)
            {
                BlockExpression be = BlockExpression.Block(Expression.New(typeof(T)));
                _creator = Expression.Lambda <Func <T> >(be).Compile();
            }
            else
            {
                _Type = EntityBuilder.BuilderEntityClass <T>(schema.FieldMaps().Select(x => (FieldMap <T>)x), schema);
                BlockExpression be = BlockExpression.Block(Expression.New(_Type));
                _creator = Expression.Lambda <Func <T> >(be).Compile();
            }
        }
Exemple #18
0
        static SkuCustomInfo()
        {
            _schema = new ObjectSchema <SkuCustomInfo>();
            _schema.AddField(x => x.id, "id");

            _schema.AddField(x => x.Sku, "Sku");

            _schema.AddField(x => x.CustomsUnit, "CustomsUnit");

            _schema.AddField(x => x.InspectionNo, "InspectionNo");

            _schema.AddField(x => x.HSCode, "HSCode");

            _schema.AddField(x => x.UOM, "UOM");

            _schema.AddField(x => x.PrepardNo, "PrepardNo");

            _schema.AddField(x => x.GnoCode, "GnoCode");

            _schema.AddField(x => x.TaxRate, "TaxRate");

            _schema.AddField(x => x.TaxCode, "TaxCode");

            _schema.AddField(x => x.ModelForCustoms, "ModelForCustoms");
            _schema.Compile();
        }
Exemple #19
0
        public void TestDynamicTypeCodeTypes()
        {
            var subSchema = new ObjectSchema()
                            .WithRequiredProperty("Id", TypeCode.String)
                            .WithRequiredProperty("FLOATFIELD", TypeCode.Double)
                            .WithOptionalProperty("nullproperty", TypeCode.Object);

            var schema = new ObjectSchema()
                         .WithRequiredProperty("intField", TypeCode.Integer)
                         .WithRequiredProperty("longField", TypeCode.Integer)
                         .WithRequiredProperty("floatField", TypeCode.Double)
                         .WithRequiredProperty("doubleField", TypeCode.Float)
                         .WithRequiredProperty("StringProperty", TypeCode.String)
                         .WithOptionalProperty("NullProperty", TypeCode.Object)
                         .WithRequiredProperty("IntArrayProperty", new ArraySchema(TypeCode.Integer))
                         .WithRequiredProperty("StringListProperty", new ArraySchema(TypeCode.String))
                         .WithRequiredProperty("MapProperty", new MapSchema(TypeCode.String, TypeCode.Integer))
                         .WithRequiredProperty("SubObjectProperty", subSchema)
                         .WithRequiredProperty("SubArrayProperty", new ArraySchema(subSchema))
                         .WithRequiredProperty("EnumIntProperty", typeof(TestEnumInt))
                         .WithRequiredProperty("EnumStringProperty", typeof(TestEnumString));

            var obj     = new TestObject();
            var results = schema.Validate(obj);

            Assert.Equal(0, results.Count);
        }
Exemple #20
0
        static SkuInfoStcok()
        {
            _SkuInfoStcok = new ObjectSchema <SkuInfoStcok>();

            _SkuInfoStcok.AddField(x => x.Id, "Id");

            _SkuInfoStcok.AddField(x => x.Sku, "Sku");

            _SkuInfoStcok.AddField(x => x.Spu, "Spu");

            _SkuInfoStcok.AddField(x => x.Price, "Price");

            _SkuInfoStcok.AddField(x => x.Status, "SendUserId");

            _SkuInfoStcok.AddField(x => x.ShelvesTime, "TradeCode");

            _SkuInfoStcok.AddField(x => x.RemovedTime, "Title");

            _SkuInfoStcok.AddField(x => x.Qty, "Content");

            _SkuInfoStcok.AddField(x => x.PreOnSaleTime, "ImagePath");

            _SkuInfoStcok.AddField(x => x.IsOnSaled, "Summary");

            _SkuInfoStcok.AddField(x => x.CreateTime, "LinkUrl");

            _SkuInfoStcok.AddField(x => x.BarCode, "StartTime");

            _SkuInfoStcok.AddField(x => x.AuditTime, "EndTime");

            _SkuInfoStcok.AddField(x => x.AlarmStockQty, "LongTerm");

            _SkuInfoStcok.Compile();
        }
        public void TestEmptySchema()
        {
            var schema  = new ObjectSchema();
            var results = schema.Validate(null);

            Assert.Equal(0, results.Count);
        }
Exemple #22
0
 // Token: 0x060008BF RID: 2239 RVA: 0x00022C3C File Offset: 0x00020E3C
 public static void Initialize(string protocolName, ObjectSchema fetchSchema, ObjectSchema querySchema, Dictionary <string, string> customPropertyGroups = null)
 {
     if (BaseConditionalRegistration.Initialized)
     {
         return;
     }
     BaseConditionalRegistration.FetchSchema = fetchSchema;
     BaseConditionalRegistration.QuerySchema = querySchema;
     ConditionalRegistrationLog.ProtocolName = protocolName;
     if (BaseConditionalRegistration.PropertyGroups == null)
     {
         BaseConditionalRegistration.PropertyGroups = new Dictionary <string, string>();
     }
     BaseConditionalRegistration.PropertyGroups.Add("user", BaseConditionalRegistration.GetConfigurationValue("UserPropertyGroup") ?? "SmtpAddress,DisplayName,TenantName,WindowsLiveId,MailboxServer,MailboxDatabase,MailboxServerVersion,IsMonitoringUser");
     BaseConditionalRegistration.PropertyGroups.Add("wlm", BaseConditionalRegistration.GetConfigurationValue("WlmPropertyGroup") ?? "IsOverBudgetAtStart,IsOverBudgetAtEnd,BudgetBalanceStart,BudgetBalanceEnd,BudgetDelay,BudgetUsed,BudgetLockedOut,BudgetLockedUntil");
     BaseConditionalRegistration.PropertyGroups.Add("policy", BaseConditionalRegistration.GetConfigurationValue("PolicyPropertyGroup") ?? "ThrottlingPolicyName,MaxConcurrency,MaxBurst,RechargeRate,CutoffBalance,ThrottlingPolicyScope,ConcurrencyStart,ConcurrencyEnd");
     BaseConditionalRegistration.PropertyGroups.Add("error", BaseConditionalRegistration.GetConfigurationValue("ErrorPropertyGroup") ?? "Exception");
     if (customPropertyGroups != null)
     {
         foreach (string key in customPropertyGroups.Keys)
         {
             if (!BaseConditionalRegistration.PropertyGroups.ContainsKey(key))
             {
                 BaseConditionalRegistration.PropertyGroups.Add(key, customPropertyGroups[key]);
             }
         }
     }
     BaseConditionalRegistration.Initialized = true;
     RegisterConditionHandler.GetInstance().HydratePersistentHandlers();
     RegisterConditionHandler.GetInstance().HydrateNonPersistentRegistrations();
 }
        public async override Task Update <T>(IDbConnection connection, ObjectSchema schema, T obj)
        {
            var names     = schema.Columns.Select(c => c.Key);
            var variables = schema.Columns.Select(c => $"@{c.Key}");
            var updates   = schema.Columns.Select(c => $"{c.Value.Name} = @{c.Value.Name}");
            var keys      = schema.Columns.Values.Where(c => c.KeyIndex > 0).Select(c => c.Name);

            await connection.ExecuteAsync($@"
            BEGIN TRANSACTION
                IF EXISTS (
                    SELECT * 
                    FROM {schema.Name}
                    WHERE ({this.GetKeyFilter(schema)})
                )
                    BEGIN
                        UPDATE {schema.Name}
                        SET {string.Join(", ", updates)}
                        WHERE ({this.GetKeyFilter(schema)})
                    END
                ELSE
                    BEGIN
                        INSERT INTO {schema.Name}
                        ({string.Join(", ", names)})
                        VALUES
                        ({string.Join(", ", variables)})
                    END
            COMMIT TRANSACTION
            ", obj);
        }
Exemple #24
0
        static ActivityModel()
        {
            _schema = new ObjectSchema <ActivityModel>();

            _schema.AddField(x => x.ID, "Id");

            _schema.AddField(x => x.Key, "Key");

            _schema.AddField(x => x.Title, "Title");

            _schema.AddField(x => x.HeadTitle, "HeadTitle");

            _schema.AddField(x => x.Discription, "Discription");

            _schema.AddField(x => x.ImgPath, "ImgPath");

            _schema.AddField(x => x.StartTime, "StartTime");

            _schema.AddField(x => x.EndTime, "EndTime");

            _schema.AddField(x => x.CreateTime, "CreateTime");

            _schema.AddField(x => x.Status, "Status");

            _schema.AddField(x => x.TempType, "TempType");

            _schema.AddField(x => x.SPUs, "SPUs");

            _schema.AddField(x => x.MainProductDescription, "MainProductDescription");

            _schema.Compile();
        }
Exemple #25
0
        static CategoryEntity()
        {
            _schema = new ObjectSchema <CategoryEntity>();
            _schema.AddField(x => x.CategoryId, "CategoryId");

            _schema.AddField(x => x.RootId, "RootId");

            _schema.AddField(x => x.CategoryName, "CategoryName");

            _schema.AddField(x => x.ParentId, "ParentId");

            _schema.AddField(x => x.SortValue, "SortValue");

            _schema.AddField(x => x.Status, "Status");

            _schema.AddField(x => x.CategoryLevel, "CategoryLevel");

            _schema.AddField(x => x.SiteImgUrl, "SiteImgUrl");

            _schema.AddField(x => x.AppImgUrl, "AppImgUrl");

            _schema.AddField(x => x.CreateTime, "CreateTime");

            _schema.AddField(x => x.CreateBy, "CreateBy");
            _schema.AddField(x => x.IsShow, "IsShow");
            _schema.AddField(x => x.Aliases, "Aliases");
            _schema.Compile();
        }
        static PromotionMainInfoModel()
        {
            _schema = new ObjectSchema <PromotionMainInfoModel>();
            _schema.AddField(x => x.Id, "Id");

            _schema.AddField(x => x.SupplierId, "SupplierId");

            _schema.AddField(x => x.PromotionName, "PromotionName");

            _schema.AddField(x => x.StartTime, "StartTime");

            _schema.AddField(x => x.EndTime, "EndTime");

            _schema.AddField(x => x.PromotionLable, "PromotionLable");

            _schema.AddField(x => x.PromotionCost, "PromotionCost");

            _schema.AddField(x => x.PromotionStatus, "PromotionStatus");

            _schema.AddField(x => x.PromotionType, "PromotionType");

            _schema.AddField(x => x.CreateTime, "CreateTime");

            _schema.AddField(x => x.CreateBy, "CreateBy");
            _schema.Compile();
        }
Exemple #27
0
 public void Setup()
 {
     this.Migrator       = new SchemaMigrator();
     this.Manager        = new SQLiteSchemaManager();
     this.Connection     = new SQLiteConnection($"Data Source={TestDbFile};Version=3;");
     this.BaselineSchema = new ObjectSchema()
     {
         Name    = "TestObject",
         Columns = new List <ColumnSchema>()
         {
             new ColumnSchema()
             {
                 Name     = "Id",
                 KeyIndex = 1,
                 SqlType  = SqlDbType.Int
             },
             new ColumnSchema()
             {
                 Name    = "Val",
                 SqlType = SqlDbType.VarChar
             },
             new ColumnSchema()
             {
                 Name       = "DotnetStringVal",
                 DotnetType = typeof(string)
             },
         }.ToDictionary(c => c.Name)
     };
     this.Options = new MigrationOptions()
     {
         AllowDataloss = true
     };
 }
        static IndexModulesEntity()
        {
            _schema = new ObjectSchema <IndexModulesEntity>();
            _schema.AddField(x => x.Id, "Id");

            _schema.AddField(x => x.Key, "Key");

            _schema.AddField(x => x.Title, "Title");

            _schema.AddField(x => x.SubTitle1, "SubTitle1");

            _schema.AddField(x => x.SubTitle2, "SubTitle2");

            _schema.AddField(x => x.ImagePath, "ImagePath");

            _schema.AddField(x => x.LinkUrl, "LinkUrl");

            _schema.AddField(x => x.CreateTime, "CreateTime");

            _schema.AddField(x => x.Description, "Description");

            _schema.AddField(x => x.RefId, "RefId");

            _schema.AddField(x => x.Sort, "Sort");

            _schema.AddField(x => x.Status, "Status");
            _schema.Compile();
        }
Exemple #29
0
        static SupplierEntity()
        {
            _schema = new ObjectSchema <SupplierEntity>();
            _schema.AddField(x => x.SupplierID, "SupplierID");

            _schema.AddField(x => x.CompanyName, "CompanyName");

            _schema.AddField(x => x.CompanyName_Sample, "CompanyName_Sample");

            _schema.AddField(x => x.CompanyName_English, "CompanyName_English");

            _schema.AddField(x => x.StoreName, "StoreName");

            _schema.AddField(x => x.Address, "Address");

            _schema.AddField(x => x.Address_Sample, "Address_Sample");

            _schema.AddField(x => x.Address_English, "Address_English");

            _schema.AddField(x => x.StoreLogoPath, "StoreLogoPath");

            _schema.AddField(x => x.StoreBannerPath, "StoreBannerPath");

            _schema.AddField(x => x.StorePageDesc, "StorePageDesc");
            _schema.AddField(x => x.Description, "Description");
            _schema.AddField(x => x.Description_Sample, "Description_Sample");
            _schema.AddField(x => x.Description_English, "Description_English");
            _schema.Compile();
        }
Exemple #30
0
        public void TestEmptySchema()
        {
            var schema  = new ObjectSchema();
            var results = schema.Validate(null);

            Assert.Empty(results);
        }