Skip to content

Schema support #9

@neilg-dev

Description

@neilg-dev

Great tool! Thank you
When specifying a table schema e.g.

.SetTableName("uccx.AgentStateDetail")

TableName later gets braces added and that caused my inserts to fail

I removed the [ and ] where they are at the moment and did this but there's no doubt some better way:

    private string _TableName;
    public string TableName {
        get { return _TableName; }
        set
        {
            if(value.StartsWith("[") || value.EndsWith("]") || value.Contains("."))
            {
                _TableName = value;
            }
            else
            {
                _TableName= "[" + value + "]";
            }
        } 
    }

As I didn't want to do the mappings by hand as my columns and properties were consistent I added this so that I didn't have to do any mapping. Wondered if it might be a helpful addition

    /// <summary>
    /// Use this method to auto map by column name
    /// </summary>
    /// <returns></returns>
    public MapperBuilder<T> AutoMapping()
    {
        foreach (PropertyInfo property in typeof(T).GetProperties())
        {
            _mapper.Mappings.Add(property.Name, property.Name);
        }

        return this;
    }

Thank you :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions