コード例 #1
0
ファイル: CmObject.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add any custom fields to the columnSpec.
		/// </summary>
		/// <remarks> note that we should be able to use the code here to handle the entire CS
		/// creation, since all fields are listed in Field$.  for now, I am just using this
		/// for custom fields in order to have the least impact on the code.</remarks>
		/// ------------------------------------------------------------------------------------
		protected static void PopulateColumnSpecWithCustomFields(Type fdoClassType, FdoCache cache,IDbColSpec columnSpec)
		{
			//ToDo: This method kills InMemoryFdoCache
			if(cache.GetType() != typeof(FdoCache))
				return;

			int iclassId =(int)GetStaticField(fdoClassType, "kClassId");
			uint classId= (uint)iclassId;

			foreach(ClassAndPropInfo info in cache.GetFieldsOfClass(classId))
			{
				if(!info.isCustom)
					continue;
				if(!info.isBasic)
					continue;
				switch(info.fieldType)
				{
					default:
						continue;
					case (int)FldType.kftString:
						columnSpec.Push((int)DbColType.koctString, 1, (int)info.flid, 0);
						columnSpec.Push((int)DbColType.koctFmt, 1, (int)info.flid, 0);
						break;
				}
			}
		}