The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Minor suggestions about generated _admin.ascx.cs files

Last post 02-28-2007, 4:43 PM by mfreidge. 0 replies.
Sort Posts: Previous Next
  •  02-28-2007, 4:43 PM 668

    Minor suggestions about generated _admin.ascx.cs files

    Hi,

    I've reviewed generated by templates _admin.ascx.cs files and have a few suggestions:
    1. In bnSave_Click() catch block should LOG errors to some event log. For DNN, there are eventLog classes, for ASPX it should write at least to Diagnostics.Trace.

    2.function LoadEntityForSeach has wrong spelling (r is missing)

    3.LoadGrid has common code

                if (this.GetSortExpression("gvBrowse") != null && this.GetSortExpression("gvBrowse").Length > 0)

                {

                      if (this.GetSortDirection("gvBrowse") == "Ascending")

                            coll.Query.OrderBy(this.GetSortExpression("gvBrowse"), esOrderByDirection.Ascending);

                      else

                            coll.Query.OrderBy(this.GetSortExpression("gvBrowse"), esOrderByDirection.Descending);

                }

    It can be easily moved to base class to reduce non-entity specific code in generated code (e.g function SetOrderByFromSortExpression(Collection coll, string GridName).
    The same function can be called for detailedGrids Load methods.


    4. In DetailedGrids bnNew..FK01_Click methods Response.Redirect  use hard-coded URLs , that rely on the DNN Friendly URL rewriter provider. If someone will switch off FriendlyUrlRewriter(or will use dirrerent provider), the URLs will not work .

    It will be better, if the URL will be generated in a base class function that will be easier to customize. 

     

     


    Michael Freidgeim
    Blog: http://geekswithblogs.net/mnf/
View as RSS news feed in XML