Example #1
0
 /// <summary>
 /// Copies the property.
 /// </summary>
 /// <param name="prop">The property.</param>
 public void CopyProperty(IMapProperty prop)
 {
     if (prop is null)
     {
         return;
     }
     MapProperties.Add(prop.Convert <TClassType>(this));
 }
 /// <summary>
 /// Gets the name of the parameter.
 /// </summary>
 /// <param name="mapProperty">The map property.</param>
 /// <param name="foreignMapping">The foreign mapping.</param>
 /// <returns>The parameter name</returns>
 protected string?GetParameterName(IMapProperty mapProperty, IMapping foreignMapping)
 {
     return(foreignMapping?.IDProperties.ToString(x => "@" + foreignMapping.TableName
                                                  + mapProperty.ParentMapping.Prefix
                                                  + mapProperty.Name
                                                  + mapProperty.ParentMapping.Suffix
                                                  + x.ColumnName));
 }
 /// <summary>
 /// Gets the name of the column.
 /// </summary>
 /// <param name="mapProperty">The map property.</param>
 /// <param name="foreignMapping">The foreign mapping.</param>
 /// <param name="suffix">The suffix.</param>
 /// <returns>The column name</returns>
 protected string?GetColumnName(IMapProperty mapProperty, IMapping foreignMapping, string suffix = "")
 {
     return(foreignMapping?.IDProperties.ToString(x => GetTableName(mapProperty.ParentMapping, suffix)
                                                  + ".[" + foreignMapping.TableName
                                                  + mapProperty.ParentMapping.Prefix
                                                  + mapProperty.Name
                                                  + mapProperty.ParentMapping.Suffix
                                                  + x.ColumnName + "]"));
 }
Example #4
0
        /// <summary>
        /// Generates the query.
        /// </summary>
        /// <param name="queryObject">The object to generate the queries from.</param>
        /// <param name="property">The property.</param>
        /// <returns>The resulting query</returns>
        public override IQuery[] GenerateQueries(TMappedClass queryObject, IClassProperty property)
        {
            return(property switch
            {
                IMapProperty TempMapProperty => MapProperty(TempMapProperty, queryObject),

                IManyToManyProperty Property => ManyToManyProperty(Property, queryObject),

                IManyToOneListProperty ManyToOne => ManyToOneProperty(ManyToOne, queryObject),

                IManyToOneProperty ManyToOne => ManyToOneProperty(ManyToOne, queryObject),

                _ => Array.Empty <IQuery>(),
            });
 public MapBehavior(IMapProperty mapProperty)
 {
     _mapProperty = mapProperty;
 }