///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Tools.Generic.GenericToolsCRUD.PrepareSave``1(``0)"]/*'/>
        public static object[] PrepareSave <T>(T t)
        {
            IEnumerable <Type>        TypesForWhichTHasManyProperties = GenericToolsTypeAnalysis.GetTypesForWhichTHasManyProperties <T>();
            Dictionary <string, Type> dynamicDBTypes     = GenericToolsTypeAnalysis.DynamicDBTypes <T>();
            Dictionary <string, Type> dynamicDBListTypes = GenericToolsTypeAnalysis.DynamicDBListTypes <T>();

            object[] res = new object[dynamicDBTypes.Count + dynamicDBListTypes.Count];
            var      i   = 0;

            foreach (PropertyInfo prop in typeof(T).GetProperties())
            {
                if (GenericToolsTypeAnalysis.DynamicDBTypes <T>().Keys.Contains(prop.Name))
                {
                    if (TypesForWhichTHasManyProperties.Contains(prop.PropertyType))
                    {
                        if (prop.GetValue(t) == null)
                        {
                            res[i] = new PropToNull(prop.Name);
                        }
                        else
                        {
                            res[i] = prop.GetValue(t);
                        }
                    }
                    else
                    {
                        res[i] = prop.GetValue(t);
                    }
                }
                else
                {
                    if (GenericToolsTypeAnalysis.DynamicDBListTypes <T>().Keys.Contains(prop.Name))
                    {
                        if (TypesForWhichTHasManyProperties.Contains(GenericToolsTypeAnalysis.DynamicDBListTypes <T>()[prop.Name]))
                        {
                            if (prop.GetValue(t) == null ||
                                (prop.GetValue(t) as IList).Count == 0)
                            {
                                res[i] = new PropToNull(prop.Name);
                            }
                            else
                            {
                                res[i] = prop.GetValue(t);
                            }
                        }
                        else
                        {
                            res[i] = prop.GetValue(t);
                        }
                    }
                    else
                    {
                        i--;
                    }
                }
                i++;
            }
            return(res);
        }
        ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Tools.Generic.GenericToolsQueriesAndLists.QueryTIncludeTracked``1(System.Data.Entity.DbContext)"]/*'/>
        public static IQueryable <T> QueryTIncludeTracked <T>(DbContext dbContext) where T : class
        {
            IQueryable <T> req = dbContext.Set <T>().AsQueryable();

            foreach (string name in GenericToolsTypeAnalysis.DynamicDBListTypes <T>().Keys.ToList())
            {
                req = req.Include(name);
            }
            foreach (string name in GenericToolsTypeAnalysis.DynamicDBTypes <T>().Keys.ToList())
            {
                req = req.Include(name);
            }
            return(req);
        }
        ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Tools.Generic.GenericToolsCRUD.PrepareUpdate``1(System.Data.Entity.DbContext,``0)"]/*'/>
        public static object[] PrepareUpdate <T>(DbContext context, T t)
        {
            foreach (Type type in GenericToolsTypeAnalysis.GetTypesInRelationWithTHavingRequiredTProperty <T>())
            {
                Dictionary <string, string> propnames = GenericToolsTypeAnalysis.PropNamesForRelationWithTWithRequired(typeof(T), type);
                if (propnames.Count() != 0)
                {
                    for (int j = 0; j < propnames.Count(); j++)
                    {
                        GenericToolsCRUDPrep.UpdateOtherPropInRelationWithTHavingRequiredTProperty <T>(context, type, t, propnames.Keys.ToList()[j], propnames[propnames.Keys.ToList()[j]]);
                    }
                }
            }
            IEnumerable <Type>        TypesForWhichTHasManyProperties = GenericToolsTypeAnalysis.GetTypesForWhichTHasManyProperties <T>();
            Dictionary <string, Type> dynamicDBTypes     = GenericToolsTypeAnalysis.DynamicDBTypes <T>();
            Dictionary <string, Type> dynamicDBListTypes = GenericToolsTypeAnalysis.DynamicDBListTypes <T>();

            object[] res = new object[dynamicDBTypes.Count + dynamicDBListTypes.Count];
            var      i   = 0;

            foreach (PropertyInfo prop in typeof(T).GetProperties())
            {
                if (GenericToolsTypeAnalysis.DynamicDBTypes <T>().Keys.Contains(prop.Name))
                {
                    if (TypesForWhichTHasManyProperties.Contains(prop.PropertyType))
                    {
                        if (prop.GetValue(t) == null)
                        {
                            res[i] = new PropToNull(prop.Name);
                        }
                        else
                        {
                            res[i] = prop.GetValue(t);
                        }
                    }
                    else
                    {
                        res[i] = prop.GetValue(t);
                    }
                }
                else
                {
                    if (GenericToolsTypeAnalysis.DynamicDBListTypes <T>().Keys.Contains(prop.Name))
                    {
                        if (TypesForWhichTHasManyProperties.Contains(GenericToolsTypeAnalysis.DynamicDBListTypes <T>()[prop.Name]))
                        {
                            if (prop.GetValue(t) == null ||
                                (prop.GetValue(t) as IList).Count == 0)
                            {
                                res[i] = new PropToNull(prop.Name);
                            }
                            else
                            {
                                res[i] = prop.GetValue(t);
                            }
                        }
                        else
                        {
                            res[i] = prop.GetValue(t);
                        }
                    }
                    else
                    {
                        i--;
                    }
                }
                i++;
            }
            return(res);
        }