Exemplo n.º 1
0
        private void SetPathAndQuery(Uri uri)
        {
            string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries);
            Path     path         = Path.OneWhere(c => c.Value == pathAndQuery[0]);

            if (path == null)
            {
                path       = new Path();
                path.Value = pathAndQuery[0];
                path.Save();
            }
            this.PathId = path.Id;

            if (pathAndQuery.Length > 1)
            {
                string query = pathAndQuery[1];
                if (string.IsNullOrEmpty(query))
                {
                    this.QueryStringId = QueryString.Empty.Id;
                }
                else
                {
                    QueryString qs = QueryString.OneWhere(c => c.Value == query);
                    if (qs == null)
                    {
                        qs       = new QueryString();
                        qs.Value = pathAndQuery[1];
                        qs.Save();
                    }
                    this.QueryStringId = qs.Id;
                }
            }
        }
Exemplo n.º 2
0
        private static Path GetPath(Uri uri)
        {
            string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries);
            Path     path         = Path.OneWhere(c => c.Value == pathAndQuery[0]);

            if (path == null)
            {
                path       = new Path();
                path.Value = pathAndQuery[0];
                path.Save();
            }

            return(path);
        }