private void InitProperties()
        {
            IList<PropertyMetadata> writeable = new List<PropertyMetadata>();
            var all = new List<PropertyMetadata>();
            foreach (var prop in DtoType.GetProperties(
                BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance))
            {
                var propMeta = new PropertyMetadata(prop);
                all.Add(propMeta);
                _propertiesByCaseInsensitiveColumnName[propMeta.ColumnName] = propMeta;

                if (!propMeta.IsSaveable)
                {
                    continue;
                }

                if (propMeta.IsPrimaryKey)
                {
                    PrimaryKey = propMeta;
                }

                if (propMeta.HasAttribute<SoftDeleteColumnAttribute>())
                {
                    SoftDeleteProperty = propMeta;
                }

                writeable.Add(propMeta);
            }

            if (HasAttribute<TableAttribute>())
            {
                //  If this type represents a table then we want to deduplicate properties
                //  mapped to columns, otherwise we don't really care.
                writeable = DeduplicateWriteablePropertiesMappedToColumns(writeable);
            }
            WriteableProperties = writeable;
            AllProperties = all;
        }
 private static void AppendJoinConditionArgument(StringBuilder fromAndJoinsBuff, PropertyMetadata property, string alias)
 {
     AppendJoinConditionArgument(fromAndJoinsBuff, property.ColumnName, alias);
 }
        private void InitProperties()
        {
            var target = new List<PropertyMetadata>();
            foreach (var prop in DtoType.GetProperties(
                BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance))
            {
                var propMeta = new PropertyMetadata(prop);
                if (!propMeta.IsSaveable)
                {
                    continue;
                }

                if (propMeta.IsPrimaryKey)
                {
                    PrimaryKey = propMeta;
                }

                if (propMeta.HasAttribute<SoftDeleteColumnAttribute>())
                {
                    SoftDeleteProperty = propMeta;
                }

                target.Add(propMeta);
                _propertiesByCaseInsensitiveColumnName[propMeta.ColumnName] = propMeta;
            }

            Properties = target;
        }
 private static void AppendJoinConditionArgument(
     TypePropertyMapEntry entry,
     StringBuilder fromAndJoinsBuff,
     PropertyMetadata property,
     string [] aliases)
 {
     if (property == null)
     {
         throw new InvalidOperationException(
             string.Format(
                 "Unable to generate JOIN condition because no suitable join property could "
                 + "be found on '{0}'. This might be because you haven't marked a property with "
                 + "the [PrimaryKey] attribute from Dapper.SimpleSave, or because no matching "
                 + "target property can be found on the target object, although this seems a bit "
                 + "unlikely. Also bear in mind that commparison with property names here is "
                 + "case-sensitive so this failure may be caused by a difference in casing between, "
                 + "say, the property name, and any column name specified in a [Column] attribute.",
                 entry.Type));
     }
     var alias = aliases == null ? entry.Alias : aliases[entry.Index];
     AppendJoinConditionArgument(fromAndJoinsBuff, property, alias);
 }