I have very less experiece with Generics and Reflection. What I assumed so for from the following sample is that it takes too much time to perform. Is there a way so that i accomplish the following without using reflection..

SCENARIO
I am working on a method which is generic. it takes an instance of a class passed to it and make SqlParameters from all of the properties. following is the code for generic method called "Store", and one more method that converts c# type to SqlDbType of DbType.

```
        List<SqlParameter> parameters = new List<SqlParameter>();
        public T Store<T>(T t)
        {
            Type type = t.GetType();
            PropertyInfo[] props = (t.GetType()).GetProperties();
            foreach (PropertyInfo p in props)
            {
                SqlParameter param = new SqlParameter();
                Type propType = p.PropertyType;
                if (propType.BaseType.Name.Equals("ValueType") || propType.BaseType.Name.Equals("Array"))
                {
                    param.SqlDbType = GetDBType(propType); //e.g. public bool enabled{get;set;} OR public byte[] img{get;set;}
                }
                else if (propType.BaseType.Name.Equals("Object"))
                {
                    if (propType.Name.Equals("String"))// for string values
                        param.SqlDbType = GetDBType(propType);
                    else
                    {
                        dynamic d = p.GetValue(t, null); // for referrences e.g. public ClassA obj{get;set;}
                        Store<dynamic>(d);
                    }
                }
                param.ParameterName = p.Name;
                parameters.Add(param);
            }
            return t;
        }

        // mehthod for getting the DbType OR SqlDbType from the type...
        private SqlDbType GetDBType(System.Type type)
        {
            SqlParameter param;
            System.ComponentModel.TypeConverter tc;
            param = new SqlParameter();
            tc = System.ComponentModel.TypeDescriptor.GetConverter(param.DbType);
            if (tc.CanConvertFrom(type))
            {
                param.DbType = (DbType)tc.ConvertFrom(type.Name);
            }
            else
            {
                // try to forcefully convert
                try
                {
                    param.DbType = (DbType)tc.ConvertFrom(type.Name);
                }
                catch (Exception e)
                {
                    switch (type.Name)
                    {
                        case "Char":
                            param.SqlDbType = SqlDbType.Char;
                            break;
                        case "SByte":
                            param.SqlDbType = SqlDbType.SmallInt;
                            break;
                        case "UInt16":
                            param.SqlDbType = SqlDbType.SmallInt;
                            break;
                        case "UInt32":
                            param.SqlDbType = SqlDbType.Int;
                            break;
                        case "UInt64":
                            param.SqlDbType = SqlDbType.Decimal;
                            break;
                        case "Byte[]":
                            param.SqlDbType = SqlDbType.Binary;
                            break;
                    }
                }
            }
            return param.SqlDbType;
        }

```

To call my method suppose i have 2 classes as following

```
public class clsParent
{
    public int pID { get; set; }
    public byte[] pImage { get; set; }
    public string pName { get; set; }
}

and

public class clsChild
{
    public decimal childId { get; set; }
    public string childName { get; set; }
    public clsParent parent { get; set; }
}

and this is a call 

clsParent p = new clsParent();
p.pID = 101;
p.pImage = new byte[1000];
p.pName = "John";
clsChild c = new clsChild();
c.childId = 1;
c.childName = "a";
c.parent = p;

Store<clsChild>(c);

```