Beispiel #1
0
        public ViewMap(string viewName)
        {
            Type                  = typeof(V);
            Name                  = string.IsNullOrEmpty(viewName) ? Type.Name : viewName;
            ColumnNames           = new Dictionary <string, string>();
            PropertyMapTranslator = new PropertyMapTranslator();
            string nameSpace = string.Empty;

            foreach (var property in Type.GetProperties())
            {
                nameSpace = property.PropertyType.Namespace;
                if (nameSpace.Equals("System") && !nameSpace.Equals("System.Collections.Generic"))
                {
                    ColumnNames.Add(property.Name, property.Name);
                }
            }
        }
Beispiel #2
0
        public QueryMap(string query)
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new Exception("The query could not be null");
            }
            Query                 = query;
            CurrentQuery          = query;
            Type                  = typeof(Q);
            ColumnNames           = new Dictionary <string, string>();
            PropertyMapTranslator = new PropertyMapTranslator();
            string nameSpace = string.Empty;

            foreach (var property in Type.GetProperties())
            {
                nameSpace = property.PropertyType.Namespace;
                if (nameSpace.Equals("System") && !nameSpace.Equals("System.Collections.Generic"))
                {
                    ColumnNames.Add(property.Name, property.Name);
                }
            }
        }
Beispiel #3
0
        public ClassMap()
        {
            Type                         = typeof(T);
            TableName                    = Type.Name;
            PrimaryKeyName               = Type.GetProperty("Id") == null ? null : "Id";
            IsAutoincrement              = !string.IsNullOrEmpty(PrimaryKeyName);
            ColumnNames                  = new Dictionary <string, string>();
            Entities                     = new Dictionary <string, IEntityMap>();
            ForeignKeys                  = new Dictionary <string, string>();
            Keys                         = new Dictionary <string, string>();
            Collections                  = new Dictionary <string, IEntityMap>();
            CollectionSelect             = new Dictionary <string, string>();
            PropertyMapTranslator        = new PropertyMapTranslator();
            PropertyForeignKeyTranslator = new PropertyForeignKeyTranslator();
            PropertyKeyMapTranslator     = new PropertyKeyMapTranslator();

            string nameSpace = string.Empty;

            foreach (var property in Type.GetProperties())
            {
                if (!property.PropertyType.IsEnum)
                {
                    nameSpace = property.PropertyType.Namespace;
                    if (nameSpace.Equals("System") && !nameSpace.Equals("System.Collections.Generic"))
                    {
                        ColumnNames.Add(property.Name, property.Name);
                    }
                    if (!nameSpace.Equals("System") && !nameSpace.Equals("System.Collections.Generic"))
                    {
                        ForeignKeys.Add(property.Name, property.Name + "_Id");
                    }
                }
                else
                {
                    ForeignKeys.Add(property.Name, property.Name + "_Id");
                }
            }
        }