コード例 #1
0
        private int ReadPrimaryKeys(SqlCommand cmd, EntityTable table, string columnName)
        {
            int primaryKeyIndex = 0;

            Logger.Debug($"Reading primary keys inserted into {table.Name}");
            Logger.Debug($"Executing SQL: {cmd.CommandText}");

            using SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                dynamic primaryKey = reader[columnName];

                Logger.Trace($"Inserted '{table.Type.Name}' entity with primary key {primaryKey.ToString()}");

                /*
                 * We need to make sure that the data rows for child entities which have a foreign key relationship
                 * to this newly inserted entity are updated with foreign keys. These are currently set to the default
                 * value of their data type, and so will all be the same - any insert operation attempted at this point
                 * would cause a foreign key exception in SQL.
                 */

                table.UpdatePrimaryKey(primaryKey, primaryKeyIndex);
                table.UpdateForeignKeys(primaryKey, primaryKeyIndex++);
            }

            return(primaryKeyIndex);
        }
コード例 #2
0
ファイル: StepTargetView.cs プロジェクト: parkheenam/test
        private void LoadData()
        {
            _dict = new Dictionary <string, ResultItem>();

            EntityTable <MicronBEAssy.Outputs.StepTarget> st = _result.LoadOutput <MicronBEAssy.Outputs.StepTarget>("StepTarget").ToEntityTable();

            string product = this.prodTextBox.Text.ToUpper();

            var filteredTable = st.Rows.Where(o => o.PRODUCT_ID.Contains(product));

            // Process Data 부분
            foreach (MicronBEAssy.Outputs.StepTarget item in filteredTable)
            {
                ResultItem ri;

                // _dict에 LINE_ID + PROD_ID + PROC_ID + STEP_ID 키로 조회되는 항목이 있으면
                // 값을 합산, 없으면 새로 등록
                string key = item.LINE_ID + item.PRODUCT_ID + item.PROCESS_ID + item.STEP_ID;

                if (_dict.TryGetValue(key, out ri) == false)
                {
                    ri = new ResultItem();

                    ri.LINE_ID    = item.LINE_ID;
                    ri.PRODUCT_ID = item.PRODUCT_ID;
                    ri.PROCESS_ID = item.PROCESS_ID;
                    ri.STEP_ID    = item.STEP_ID;

                    _dict.Add(key, ri);
                }
                ri.IN_QTY  += Convert.ToDouble(item.IN_QTY);
                ri.OUT_QTY += Convert.ToDouble(item.OUT_QTY);
            }
        }
コード例 #3
0
        /// <summary>
        /// 登錄到記憶體中
        /// </summary>
        /// <param name="entityTable"></param>
        public void Regist(EntityTable entityTable, OPStatus opStatus)
        {
            //if (entityTable == null) return;
            if (entityTable == null || (opStatus == OPStatus.Steady && entityTable.HasCollectionChangedEventSubscriber()))
            {
                return;
            }
            if (opStatus.IsPassSchema())
            {
                entityTable.GetAttributesEntity().Status = opStatus;
                updatingTables[GenKey(entityTable, true)] = entityTable;
                return;
            }

            //if(HasCollectionChangedEventSubscriber())
            var attris = entityTable.GetAttributesEntity();

            attris.Status = opStatus;
            entityTable.CollectionChanged -= OnTableCollectionChanged;
            entityTable.CollectionChanged += OnTableCollectionChanged;
            //Comment out: 每次因EntityTable的rows可能數量不同,有的是部分
            //if (!attris.IsPartial&&updatingTables.ContainsKey(GenKey(entityTable)))
            //    return;
            Action <EntityRow> action = delegate(EntityRow row)
            {
                var attribute = row.GetAttributesEntity();
                //attribute.Status = opStatus;
                row.PropertyChanged -= OnRowChanged;
                row.PropertyChanged += OnRowChanged;
            };
            EntityTable registedTable = TakeRegistedTable(entityTable);

            entityTable.Rows.ForEach(row => { action(row); DoRegist(registedTable, row, opStatus); });
        }
コード例 #4
0
        /// <summary>
        /// 获取当前 实体数据模型 上下问中指定实体类型的数据库表映射关系。
        /// </summary>
        /// <param name="_this">实体数据上下文对象。</param>
        /// <param name="entityType">实体数据模型类型,对应当前数据库上下文中的一个表。</param>
        /// <returns>返回实体数据模型类型 <paramref name="entityType"/> 对应当前实体数据上下文对象中数据库的相应数据表的映射关系描述对象。</returns>
        public static EntityTable GetEntityTable(this System.Data.Entity.DbContext _this, Type entityType)
        {
            Check.NotNull(_this);
            Check.NotNull(entityType);
            Type thisType = _this.GetType();
            Dictionary <Type, EntityTable> dict = null;
            EntityTable table = null;

            lock (_entityTableCache)
            {
                if (!_entityTableCache.Value.TryGetValue(thisType, out dict))
                {
                    dict = new Dictionary <Type, EntityTable>();
                    _entityTableCache.Value.Add(thisType, dict);
                }
                if (!dict.TryGetValue(entityType, out table))
                {
                    table = GetEntityTables(_this).FirstOrDefault(t => t.EntityType == entityType);
                    if (table != null)
                    {
                        dict.Add(entityType, table);
                    }
                }
            }
            return(table);
        }
コード例 #5
0
        internal void UpdateParameters(IEntity item)
        {
            Type        type  = item.GetType();
            EntityTable table = Mapping.TypeTableMapping[type];

            foreach (Column column in table.Columns)
            {
                string propertyName  = column.PropertyName;
                object propertyValue = item.GetPropertyValue(propertyName);

                if (propertyValue == null || (column.IsPrimaryKey() && propertyValue == default))
                {
                    continue;
                }

                column.AddParameter(propertyValue);
            }

            foreach (EntityTable childTable in table.ChildTables)
            {
                foreach (dynamic childItem in item.GetChildPropertyValues(childTable.Name))
                {
                    UpdateParameters(childItem);
                }
            }
        }
コード例 #6
0
        public void DeleteAllRequestsForUser(Guid userID)
        {
            EntityTable.DeleteAllOnSubmit(from c in EntityTable where c.WatchedUserID == userID ||
                                          c.WatchingUserID == userID select c);

            CommitChanges();
        }
コード例 #7
0
    private void Start()
    {
        this.entityData = (EntityTable)Resources.Load("Data/EntityTable");

        foreach (EntityTable.Sheet sheet in entityData.sheets)
        {
            foreach (EntityTable.Param param in sheet.list)
            {
                Debug.Log(param.ToString());
                entityTable.Add(param.ID, new EntityModel(param.ID, param.EntityCategory, param.EntityType, param.HP,
                                                          param.Level, param.AttackPower, param.SearchRange, param.AttackSpeed, param.Prefab));
            }
        }

        this.stageData = (StageTable)Resources.Load("Data/StageTable");
        Debug.Log("StageTable import Start......");
        foreach (StageTable.Sheet sheet in stageData.sheets)
        {
            foreach (StageTable.Param param in sheet.list)
            {
                stageTable.Add(param.ID, new StageModel(param.ID, param.Level, param.EntityId, param.EntityCnt, param.BossEntityId, param.BossCnt));
            }
        }

        Debug.Log("StageTable import end......");
        if (this.soundData == null)
        {
            this.soundData = ScriptableObject.CreateInstance <SoundData>();
            this.soundData.LoadData();
        }
    }
コード例 #8
0
 static public EntityDigest GenEntityDigest(this EntityTable table)
 {
     return(new EntityDigest()
     {
         Key = table.TableName, Version = table.Version
     });
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: piepieonline/TDLModding
 public void loadTable()
 {
     Entity.entities.Clear();
     XMLHelpers.currentFileName = this.entityFile.name;
     this.loadFromString((string)TDLHookClass.LoadTDLHook(new object[] { "loadEntityTable" }));
     XMLHelpers.currentFileName = this.entityAimFile.name;
     if (EntityTable.ensureAimXmlFileName())
     {
         try
         {
             string str = File.ReadAllText(EntityTable.aimXmlFileFullName);
             if (str.Length > 0)
             {
                 TDLLogging.LogRuntimeInfo("entity_table_aim_1", string.Concat("Loaded aim.xml data from SVN project location. ", EntityTable.aimXmlFileFullName));
                 this.loadAimFromString(str);
                 return;
             }
         }
         catch
         {
         }
     }
     TDLLogging.LogRuntimeInfo("entity_table_aim_2", "Loaded aim.xml data from normal TDL.exe bundle.");
     this.loadAimFromString(this.entityAimFile.text);
 }
コード例 #10
0
        public void CreateStagingTable(EntityTable table)
        {
            _sql.AppendLine($"create table {table.StagingTable.Name}");
            _sql.AppendLine("(");

            for (int i = 0; i < table.EntityColumns.Count; i++)
            {
                EntityColumn column    = table.EntityColumns[i];
                SqlDbType    sqlDbType = column.GetSqlDbType();

                if (column.IsPrimaryKey())
                {
                    continue;
                }
                else
                {
                    _sql.Append($"{column.Name} {sqlDbType.ToSqlString()} not null");
                }

                _sql.AppendLine(i == table.EntityColumns.Count - 1 ? "" : ",");
            }

            _sql.AppendLine(")")
            .AppendLine();
        }
コード例 #11
0
ファイル: MapForm.cs プロジェクト: iaco79/HiOctaneTools
        public MapForm(ref byte[] bytes, Atlas atlas, string outFilename)
        {
            this.atlas       = atlas;
            this.outFilename = outFilename;

            InitializeComponent();

            canvasBox.DoubleBuffered(true);

            initColors();
            EntityTable.Init(entityTable);
            ColumnTable.Init(columnTable);
            BlockTexTable.Init(blockTexTable);
            UnknownTable247264.Init(unknownTable247264);
            UnknownTable358222.Init(unknownTable358222);

            data = bytes;
            findHeightExtremes();
            fillEntityTable();
            fillColumnTable();
            fillBlockTexTable();
            fillUnknownTable247264();
            fillUnknownTable358222();
            draw();
        }
コード例 #12
0
        /// <summary>
        /// SheetからEntityTableへの変換
        /// </summary>
        /// <param name="sheet">対象シート</param>
        /// <returns>変換したEntityTable</returns>
        /// <remarks>
        /// Excel格納情報 (列,行)表記
        ///  ( 2, 2) テーブル物理名(値は文字列)
        ///  ( 2, 3) テーブル論理名(値は文字列)
        /// 以下フィールド情報。5行目はヘッダー、6行目から空白値まで値
        ///  ( 1, 6) フィールドNoの開始位置(値は数値)
        ///  ( 2, 6) フィールド物理名の開始位置(値は文字列)
        ///  ( 3, 6) フィールド論理名の開始位置(値は文字列)
        ///  ( 4, 6) フィールドコメントの開始位置(値は文字列)
        ///  ( 5, 6) フィールド型の開始位置(値は文字列)
        ///  ( 6, 6) フィールドサイズの開始位置(値は数値)
        ///  ( 7, 6) フィールドNull制約有無の開始位置(値は〇 or 空白)
        ///  ( 8, 6) フィールドデフォルト値の開始位置(値は文字列)
        ///  ( 9, 6) フィールド主キーの開始位置(値は〇 or 空白)
        ///
        /// </remarks>
        private EntityTable ConvertSheetToEntityTable(ExcelObject sheet)
        {
            var newEntityTable = new EntityTable
            {
                PhysicsName = sheet["B2"],
                LogicName   = sheet["B3"]
            };

            var fields = new List <EntityField>();

            for (int cnt = 0; cnt < 65535; cnt++)
            {
                var row = (cnt + 6).ToString();
                // フィールドのNo値が空白の場合、処理を抜ける
                if (string.IsNullOrEmpty(sheet["A" + row]))
                {
                    break;
                }
                var field = new EntityField();
                field.No          = intParseEx(sheet["A" + row]);
                field.PhysicsName = sheet["B" + row];
                field.LogicName   = sheet["C" + row];
                //field.Comment = sheet["D" + row];
                field.FieldType = SqlServerConfiguration.ConvertFieldTypeToString(sheet["E" + row]);
                field.FieldSize = sheet["F" + row] == "" ? 0 : intParseEx(sheet["F" + row]);
                field.Nullable  = sheet["G" + row] == "〇" ? true : false;
                field.Required  = sheet["H" + row] == "〇" ? true : false;

                fields.Add(field);
            }
            newEntityTable.Fields = fields;

            return(newEntityTable);
        }
コード例 #13
0
        public void BuildUpdateStatement()
        {
            EntityTable   table   = _mapping.TypeTableMapping[_baseType];
            List <Column> columns = table.Columns.Where(c => !c.IsPrimaryKey()).ToList();

            _sql.AppendLine(new UpdateStatement(columns).ToString());
        }
コード例 #14
0
        public void Unregist(EntityTable entityTable, bool isSchema)
        {
            string key = GenKey(entityTable, isSchema);

            entityTable.CollectionChanged -= OnTableCollectionChanged;
            updatingTables.Remove(key);
        }
コード例 #15
0
        private EntityTable TakeRegistedTable(EntityTable srcTable)
        {
            EntityTable table;
            string      key = GenKey(srcTable);

            if (!updatingTables.TryGetValue(key, out table))
            {
                //by feng 100/08/26 ,此處應該不需作Clone,若改回則須同時改回Common.DataCore.EntityExtension.GroupToTables()
                //之tableAttributes.KeyCount = maxKeyCount;
                //table = srcTable.Clone(false);
                table = srcTable;
                updatingTables[key] = table;
            }
            else
            {
                if (!srcTable.GetAttributesEntity().IsPartial)
                {//置換,但不能做    Uuregist把CollectionChanged event移除
                    updatingTables[key] = srcTable;
                }
                else
                {
                    //Add by Feng 100/08/25
                    table.GetAttributesEntity().KeyCount = srcTable.GetAttributesEntity().KeyCount;
                }
            }
            return(table);
        }
コード例 #16
0
ファイル: EntityTableImporter.cs プロジェクト: fusa-nova/RTS
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            EntityTable data = (EntityTable)AssetDatabase.LoadAssetAtPath(exportPath, typeof(EntityTable));
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <EntityTable> ();
                AssetDatabase.CreateAsset((ScriptableObject)data, exportPath);
                data.hideFlags = HideFlags.NotEditable;
            }

            data.sheets.Clear();
            using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) {
                IWorkbook book = new HSSFWorkbook(stream);

                foreach (string sheetName in sheetNames)
                {
                    ISheet sheet = book.GetSheet(sheetName);
                    if (sheet == null)
                    {
                        Debug.LogError("[Data] sheet not found:" + sheetName);
                        continue;
                    }

                    EntityTable.Sheet s = new EntityTable.Sheet();
                    s.name = sheetName;

                    for (int i = 1; i < sheet.LastRowNum; i++)
                    {
                        IRow  row  = sheet.GetRow(i);
                        ICell cell = null;

                        EntityTable.Param p = new EntityTable.Param();

                        cell = row.GetCell(0); p.ID = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(1); p.EntityCategory = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(2); p.EntityType = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(3); p.HP = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(4); p.Level = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(5); p.Prefab = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(6); p.SearchRange = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(7); p.AttackPower = (int)(cell == null ? 0 : cell.NumericCellValue);
                        cell = row.GetCell(8); p.AttackSpeed = (float)(cell == null ? 0 : cell.NumericCellValue);
                        s.list.Add(p);
                    }
                    data.sheets.Add(s);
                }
            }

            ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject;
            EditorUtility.SetDirty(obj);
        }
    }
コード例 #17
0
        /// <summary>
        /// Returns the column data based on the given name.
        /// If the column is not found, returns null.
        /// </summary>
        public static IArray <T> GetColumnData <T>(this Document doc, EntityTable table, string name)
        {
            if (table == null)
            {
                return(null);
            }

            var type = typeof(T);

            if (type == typeof(DVector2))
            {
                var mcd = doc.GetMultiColumnData <double>(table, $"{name}.X", $"{name}.Y");
                return(mcd?[0].Zip(mcd[1], (x, y) => new DVector2(x, y)) as IArray <T>);
            }

            if (type == typeof(Vector2))
            {
                var mcd = doc.GetMultiColumnData <float>(table, $"{name}.X", $"{name}.Y");
                return(mcd?[0].Zip(mcd[1], (x, y) => new Vector2(x, y)) as IArray <T>);
            }

            if (type == typeof(DVector3))
            {
                var mcd = doc.GetMultiColumnData <double>(table, $"{name}.X", $"{name}.Y", $"{name}.Z");
                return(mcd?[0].Zip(mcd[1], mcd[2], (x, y, z) => new DVector3(x, y, z)) as IArray <T>);
            }

            if (type == typeof(Vector3))
            {
                var mcd = doc.GetMultiColumnData <float>(table, $"{name}.X", $"{name}.Y", $"{name}.Z");
                return(mcd?[0].Zip(mcd[1], mcd[2], (x, y, z) => new Vector3(x, y, z)) as IArray <T>);
            }

            if (type == typeof(DVector4))
            {
                var mcd = doc.GetMultiColumnData <double>(table, $"{name}.X", $"{name}.Y", $"{name}.Z", $"{name}.Z");
                return(mcd?[0].Zip(mcd[1], mcd[2], mcd[3], (x, y, z, w) => new DVector4(x, y, z, w)) as IArray <T>);
            }

            if (type == typeof(Vector4))
            {
                var mcd = doc.GetMultiColumnData <float>(table, $"{name}.X", $"{name}.Y", $"{name}.Z", $"{name}.Z");
                return(mcd?[0].Zip(mcd[1], mcd[2], mcd[3], (x, y, z, w) => new Vector4(x, y, z, w)) as IArray <T>);
            }

            if (type == typeof(DAABox))
            {
                var mcd = doc.GetMultiColumnData <DVector3>(table, $"{name}.Min", $"{name}.Max");
                return(mcd?[0].Zip(mcd[1], (x, y) => new DAABox(x, y)) as IArray <T>);
            }

            if (type == typeof(AABox))
            {
                var mcd = doc.GetMultiColumnData <Vector3>(table, $"{name}.Min", $"{name}.Max");
                return(mcd?[0].Zip(mcd[1], (x, y) => new AABox(x, y)) as IArray <T>);
            }

            return(doc.GetColumnData <T>(table?.GetColumn(name)));
        }
コード例 #18
0
 static public bool IsColumnChanged(EntityTable tbl)
 {
     if (tbl.OldSchema == null)
     {
         return(false);
     }
     return(DefaultTransfer.ToText(tbl.Rows) != DefaultTransfer.ToText(tbl.OldSchema.Rows));
 }
コード例 #19
0
 static public bool IsNamingChanged(EntityTable tbl)
 {
     if (tbl.OldSchema == null)
     {
         return(false);
     }
     return(tbl.Namespace != tbl.OldSchema.Namespace || tbl.TableName != tbl.OldSchema.TableName);
 }
コード例 #20
0
ファイル: Library.cs プロジェクト: Shine6Z/GenXSource
 public Library(Context context)
 {
     this.context        = context;
     this.entityTable    = new EntityTable();
     this.archTable      = new ArchitectureTable();
     this.theoremTable   = new TheoremTable();
     this.structureTable = new StructureTable();
 }
コード例 #21
0
        public static IQueryable <TEntity> SelectAll(string sortExpression)
        {
            if (String.IsNullOrEmpty(sortExpression))
            {
                return(SelectAll());
            }

            return(EntityTable.OrderBy(sortExpression));
        }
コード例 #22
0
        private void AssociateWithParent(IEntity entity, EntityTable table)
        {
            EntityTable  parentTable      = table.ParentTable;
            EntityColumn foreignKeyColumn = table.GetForeignKeyColumnFor(parentTable);
            object       foreignKey       = entity.GetPropertyValue(foreignKeyColumn.PropertyName);
            IEntity      parentEntity     = entityPrimaryKeyDictionary[parentTable][foreignKey];

            parentEntity.AddChildPropertyValue(table.Name, entity);
        }
コード例 #23
0
 public bool TryGetForeignTable(out EntityTable foreignTable)
 {
     if (!this.EntityRelation.IsEmptyKeys())
     {
         return(SourceProvider.TryGetTable(this.EntityRelation, out foreignTable));
     }
     foreignTable = null;
     return(false);
 }
コード例 #24
0
        private void MapEntity(IEntity entity, EntityTable table)
        {
            if (!entityPrimaryKeyDictionary.ContainsKey(table))
            {
                entityPrimaryKeyDictionary.Add(table, new Dictionary <object, IEntity>());
            }

            entityPrimaryKeyDictionary[table].Add(entity.GetID(), entity);
        }
コード例 #25
0
        public EntityQuery <TBase> Create(TBase item)
        {
            OperationType = CRUDOperationTypes.Create;

            EntityTable table = Mapping.TypeTableMapping[baseType];

            table.StageForInsertion(item as IEntity);

            return(this);
        }
コード例 #26
0
        internal DeleteStatement(EntityTable table)
            : base(table)
        {
            /*
             * We can only run an delete query for columns that have a direct database mapping, i.e a column with that name actually
             * appears in the database. Because of this, we use only the EntityColumn type.
             */

            allowedColumnTypes = ColumnTypes.EntityColumn;
        }
コード例 #27
0
        private void ReadResultsForTable(SqlDataReader reader, EntityTable table)
        {
            while (reader.Read())
            {
                IEntity entity = ReadEntity(reader, table);

                MapEntity(entity, table);
                AddResult(entity, table);
            }
        }
コード例 #28
0
        public void AssertNumberOfRows(int exhibitId, int expectedValue)
        {
            var actualNumberOfRowsInEntityTable = new EntityTable(ConnectionString).GetNumberOfRows(exhibitId);

            var expectedNumberOfRowsInEntityTable = expectedValue;

            Assert.True(actualNumberOfRowsInEntityTable.Equals(expectedNumberOfRowsInEntityTable),
                        "The number of rows in Entity table is not equal to the expected number. Expected: " +
                        expectedNumberOfRowsInEntityTable + ", but was: " + actualNumberOfRowsInEntityTable + ". Exhibit id is " + exhibitId);
        }
コード例 #29
0
ファイル: EntityTableTest.cs プロジェクト: Jath1024/DangrLib
        public void EntityTable_Test()
        {
            var        table = new EntityTable <TestEntity>(new TestPartitionTable());
            TestEntity e     = new TestEntity(table);

            Assert.AreEqual(table.Get(e.EntityInfo.EntityId), e, "Entity not added to table");

            e.Destroy();
            Assert.AreEqual(table.Get(e.EntityInfo.EntityId), null, "Entity not removed from table");
        }
コード例 #30
0
        private static object InternalDuplicateWithNonKeys(object _this, System.Data.Entity.DbContext context, Type entityType, Func <object> duplicater)
        {
            if (_this == null)
            {
                return(null);
            }

            Check.NotNull(context);
            Check.NotNull(entityType);
            Check.NotNull(duplicater);

            if (entityType.IsAbstract)
            {
                entityType = _this.GetType();
            }

            EntityTable table = context.GetEntityTable(entityType);

            if (table == null || table.ModelType == null)
            {
                throw new InvalidOperationException(string.Format("类型 {0} 不是实体数据库上下文 {1} 中定义的一个实体模型类型。", entityType, context));
            }

            EdmMember[] keys = table.ModelType.KeyMembers.ToArray();
            if (keys.Length == 0)
            {
                return(_this);
            }

            var properties = (from p in entityType.GetProperties()
                              where p.GetMethod != null && p.SetMethod != null && keys.Any(k => k.Name == p.Name)
                              select p).ToArray();
            var fields = (from f in entityType.GetFields()
                          where keys.Any(k => k.Name == f.Name)
                          select f).ToArray();

            if (properties.Length == 0 && fields.Length == 0)
            {
                return(_this);
            }

            object obj = duplicater();

            // 将 KeyMembers 设置为类型默认值,即去除 KeyMembers 属性的值。
            foreach (PropertyInfo p in properties)
            {
                p.SetValue(obj, null);
            }
            foreach (FieldInfo f in fields)
            {
                f.SetValue(obj, null);
            }

            return(obj);
        }
コード例 #31
0
 public DeleteStatement(EntityTable table)
     : base("DELETE", table)
 {
 }
コード例 #32
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            _project = new Project();
            _ctrl = new NetronController(_project, Application.Diagram);

            // attach a system logger (with console output), something
            // we get for free thanks to the channels subsystem (mediator/observer).
            LogObserver lo = new LogObserver(new TextLogWriter(Console.Out));
            _project.AttachLocalObserver(lo);
            _table = _project.Context.Library.Entities;
            UpdateEntities();
            
        }
コード例 #33
0
 protected internal InsertStatement(EntityTable table)
     : base("INSERT", table)
 {
 }
コード例 #34
0
 protected internal QueryStatement(string keyword, EntityTable table)
 {
     this.Keyword = keyword;
     this.Table = table;
 }
コード例 #35
0
        public void AppendEntities(EntityTable table)
        {
            if(table == null)
                throw new ArgumentNullException("table");

            #region Arithmetics
            table.Add(new NaryToOneGenericEntity("+", "Add", "Std", InfixNotation.LeftAssociativeInnerOperator, 60));
            table.Add(new NaryToOneGenericEntity("-", "Subtract", "Std", InfixNotation.LeftAssociativeInnerOperator, 60));
            table.Add(new NaryToOneGenericEntity("*", "Multiply", "Std", InfixNotation.LeftAssociativeInnerOperator, 50));
            table.Add(new NaryToOneGenericEntity("/", "Divide", "Std", InfixNotation.LeftAssociativeInnerOperator, 50));
            table.Add(new SymmetricGenericEntity("-", "Negate", "Std", InfixNotation.PreOperator, 20));
            table.Add(new SymmetricGenericEntity("inv", "Invert", "Std"));
            table.Add(new SymmetricGenericEntity("abs", "Absolute", "Std"));
            table.Add(new SymmetricGenericEntity("exp", "Exponential", "Std"));
            table.Add(new SymmetricGenericEntity("ln", "NaturalLogarithm", "Std"));
            table.Add(new SymmetricGenericEntity("sqr", "Square", "Std"));
            table.Add(new Entity("^", "Power", "Std", InfixNotation.RightAssociativeInnerOperator, 19, new string[] { "Power_base", "Power_radix" }, new string[] { "Power_out" }));
            table.Add(new Entity("!", "Factorial", "Std", InfixNotation.PostOperator, 45, new string[] { "Factorial_in" }, new string[] { "Factorial_out" }));
            #endregion
            #region Trigonometry
            table.Add(new SymmetricGenericEntity("sin", "Sine", "Std"));
            table.Add(new SymmetricGenericEntity("cos", "Cosine", "Std"));
            table.Add(new SymmetricGenericEntity("tan", "Tangent", "Std"));
            table.Add(new SymmetricGenericEntity("cot", "Cotangent", "Std"));
            table.Add(new SymmetricGenericEntity("sec", "Secant", "Std"));
            table.Add(new SymmetricGenericEntity("csc", "Cosecant", "Std"));
            table.Add(new SymmetricGenericEntity("asin", "InverseSine", "Std"));
            table.Add(new SymmetricGenericEntity("acos", "InverseCosine", "Std"));
            table.Add(new SymmetricGenericEntity("atan", "InverseTangent", "Std"));
            table.Add(new SymmetricGenericEntity("acot", "InverseCotangent", "Std"));
            table.Add(new SymmetricGenericEntity("asec", "InverseSecant", "Std"));
            table.Add(new SymmetricGenericEntity("acsc", "InverseCosecant", "Std"));
            table.Add(new SymmetricGenericEntity("sinh", "HyperbolicSine", "Std"));
            table.Add(new SymmetricGenericEntity("cosh", "HyperbolicCosine", "Std"));
            table.Add(new SymmetricGenericEntity("tanh", "HyperbolicTangent", "Std"));
            table.Add(new SymmetricGenericEntity("coth", "HyperbolicCotangent", "Std"));
            table.Add(new SymmetricGenericEntity("sech", "HyperbolicSecant", "Std"));
            table.Add(new SymmetricGenericEntity("csch", "HyperbolicCosecant", "Std"));
            table.Add(new SymmetricGenericEntity("asinh", "InverseHyperbolicSine", "Std"));
            table.Add(new SymmetricGenericEntity("acosh", "InverseHyperbolicCosine", "Std"));
            table.Add(new SymmetricGenericEntity("atanh", "InverseHyperbolicTangent", "Std"));
            table.Add(new SymmetricGenericEntity("acoth", "InverseHyperbolicCotangent", "Std"));
            table.Add(new SymmetricGenericEntity("asech", "InverseHyperbolicSecant", "Std"));
            table.Add(new SymmetricGenericEntity("acsch", "InverseHyperbolicCosecant", "Std"));
            #endregion
            #region Logic
            table.Add(new NaryToOneGenericEntity("and", "And", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("nand", "Nand", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("or", "Or", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("nor", "Nor", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("xor", "Xor", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("xnor", "Xnor", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new NaryToOneGenericEntity("imp", "Imply", "Std", InfixNotation.LeftAssociativeInnerOperator, 250));
            table.Add(new SymmetricGenericEntity("not", "Not", "Std", InfixNotation.PreOperator, 250));
            #endregion
            #region Algebra & Analysis
            table.Add(new NearlySymmetricGenericEntity("diff", "Derive", "Std", 1, 0));
            table.Add(new SymmetricGenericEntity("asimplify", "AutoSimplify", "Std"));
            #endregion
            #region Flow
            table.Add(new SymmetricGenericEntity("<-", "Transport", "Std"));
            table.Add(new NearlySymmetricGenericEntity("$", "Sync", "Std", 1, 0));
            table.Add(new SymmetricGenericEntity("clk", "Clock", "Std"));
            #endregion
        }
コード例 #36
0
 public SelectStatement(EntityTable table)
     : base("SELECT", table)
 {
 }
コード例 #37
0
 public WhereStatement(EntityTable table)
     : base("WHERE", table)
 {
 }
コード例 #38
0
 public UpdateStatement(EntityTable table)
     : base("UPDATE", table)
 {
 }
コード例 #39
0
 public OrderByStatement(EntityTable table)
     : base("ORDER BY", table)
 {
 }