コード例 #1
0
		/// <summary>
		/// Generates all the 'find by' methods of this interface.
		/// </summary>
		/// <param name="classMap">The class map.</param>
		/// <param name="file">The file.</param>
		private static void GenerateFindByMethods(IClassMap classMap, StreamWriter file)
		{
			foreach (KeyValuePair<int, IList<IPropertyMap>> pair in classMap.DOLGetFindByGroups())
			{
				IList<IPropertyMap> paramProps = pair.Value;
				
				string findBy = StringUtility.CombineObjects(paramProps, MapToStringConverters.PropertyAnd)
					.ToString();
				
				// method name
				file.Write("		IList<" + EntityGenerator.GetTypeName(classMap) + "> FindBy" + findBy);
				
				// method's params
				file.Write("(");
				bool first = true;
				foreach (IPropertyMap propertyMap in paramProps)
				{
					if (!first)
					{
						file.Write(", ");
					}
						
					// param type and name
					string paramName = ClassUtility.GetParamName(propertyMap);
					string paramType = ClassUtility.ConvertColumnTypeToCsType(propertyMap.GetColumnMap().DataType);
					file.Write(paramType + " " + paramName);
					first = false;
				}
				file.Write(");");
					
				file.WriteLine();

			}
		}
コード例 #2
0
        /// <summary>
        /// Generates all the 'find by' methods of this interface.
        /// </summary>
        /// <param name="classMap">The class map.</param>
        /// <param name="file">The file.</param>
        private static void GenerateFindByMethods(IClassMap classMap, StreamWriter file)
        {
            foreach (KeyValuePair <int, IList <IPropertyMap> > pair in classMap.DOLGetFindByGroups())
            {
                IList <IPropertyMap> paramProps = pair.Value;

                string findBy = StringUtility.CombineObjects(paramProps, MapToStringConverters.PropertyAnd)
                                .ToString();

                // method name
                file.Write("		IList<"+ EntityGenerator.GetTypeName(classMap) + "> FindBy" + findBy);

                // method's params
                file.Write("(");
                bool first = true;
                foreach (IPropertyMap propertyMap in paramProps)
                {
                    if (!first)
                    {
                        file.Write(", ");
                    }

                    // param type and name
                    string paramName = ClassUtility.GetParamName(propertyMap);
                    string paramType = ClassUtility.ConvertColumnTypeToCsType(propertyMap.GetColumnMap().DataType);
                    file.Write(paramType + " " + paramName);
                    first = false;
                }
                file.Write(");");

                file.WriteLine();
            }
        }
コード例 #3
0
        /// <summary>
        /// Generates all the 'count by' methods.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="classMap">The class map.</param>
        private void GenerateAllCountBy(StreamWriter file, IClassMap classMap)
        {
            // get all 'count by' groups
            foreach (KeyValuePair <int, IList <IPropertyMap> > pair in classMap.DOLGetFindByGroups())
            {
                IList <IPropertyMap> paramProps = pair.Value;
                string findBy = StringUtility.CombineObjects(paramProps, MapToStringConverters.PropertyAnd)
                                .ToString();

                // method name
                file.Write("		public virtual long CountBy"+ findBy);

                // method's params
                file.Write("(");
                bool first = true;
                foreach (IPropertyMap propertyMap in paramProps)
                {
                    if (!first)
                    {
                        file.Write(", ");
                    }

                    // param type and name
                    string paramName = ClassUtility.GetParamName(propertyMap);
                    string paramType = ClassUtility.ConvertColumnTypeToCsType(propertyMap.GetColumnMap().DataType);
                    file.Write(paramType + " " + paramName);
                    first = false;
                }
                file.Write(")");

                file.WriteLine();
                file.WriteLine("		{");
                GenerateCountBy(file, paramProps, classMap);
                file.WriteLine("		}");

                file.WriteLine();
            }
        }
コード例 #4
0
		/// <summary>
		/// Generates all the 'count by' methods.
		/// </summary>
		/// <param name="file">The file.</param>
		/// <param name="classMap">The class map.</param>
		private void GenerateAllCountBy(StreamWriter file, IClassMap classMap)
		{
			// get all 'count by' groups
			foreach (KeyValuePair<int, IList<IPropertyMap>> pair in classMap.DOLGetFindByGroups())
			{
				IList<IPropertyMap> paramProps = pair.Value;
				string findBy = StringUtility.CombineObjects(paramProps, MapToStringConverters.PropertyAnd)
					.ToString();
				
				// method name
				file.Write("		public virtual long CountBy" + findBy);

				// method's params
				file.Write("(");
				bool first = true;
				foreach (IPropertyMap propertyMap in paramProps)
				{
					if (!first)
					{
						file.Write(", ");
					}

					// param type and name
					string paramName = ClassUtility.GetParamName(propertyMap);
					string paramType = ClassUtility.ConvertColumnTypeToCsType(propertyMap.GetColumnMap().DataType);
					file.Write(paramType + " " + paramName);
					first = false;
				}
				file.Write(")");

				file.WriteLine();
				file.WriteLine("		{");
				GenerateCountBy(file, paramProps, classMap);
				file.WriteLine("		}");

				file.WriteLine();
			}
		}