Beispiel #1
0
        /// <summary>
        ///     Creates a new instance of the Doc parameter's type passed; merged/automapped/overlayed with another instance of
        ///     that same type constructed straight from the current template.xml located in the ~/form/{DocTypeName}/template.xml
        ///     of this application. Other properties specific not defined in the template.xml's text specific to this solution's
        ///     BaseDoc super-class & the current HttpContext are also inflated.
        /// </summary>
        /// <param name="DocSrc"></param>
        /// <param name="Doc"></param>
        /// <param name="DocKeys"></param>
        /// <param name="RelayUrl"></param>
        /// <param name="ProcessTemplate"></param>
        /// <returns></returns>
        public virtual object Create(out string DocSrc, object Doc, Dictionary <string, string> DocKeys = null, string RelayUrl = null, bool ProcessTemplate = true)
        {
            string DocTypeName = ((BaseDoc)Doc).DocTypeName;

            // apply ~/form/{DocTypeName}/template.xml values to document passed into us
            if (ProcessTemplate)
            {
                Doc = PropertyOverlay.Overlay(Doc, DocInterpreter.Instance.Create(DocTypeName));
            }


            if (DocKeys != null)
            {
                if (DocKeys.Count > 0)
                {
                    ((IDocIdentifiers)Doc).DocId = DocKey.DocIdFromKeys(DocKeys);
                }
            }

            //TODO:need to type-safe all the "object Doc" parameter methods
            ((BaseDoc)Doc).DocChecksum = CalcDocChecksum((BaseDoc)Doc);

            DocSrc = Nav.ToUrl((BaseDoc)Doc, RelayUrl);

            return(Doc);
        }
Beispiel #2
0
        public virtual object Read(out string DocSrc, string DocData, out Dictionary <string, string> DocKeys, string RelayUrl = null)
        {
            BaseDoc _BaseDoc = DocInterpreter.Instance.Read(DocData);

            DocKeys = DocKey.DocIdToKeys(((IDocIdentifiers)_BaseDoc).DocId);
            return(Create(out DocSrc, _BaseDoc, DocKeys, RelayUrl, false));
        }
Beispiel #3
0
 public static Dictionary <string, string> GetDocKeys(this LightDoc lightdoc)
 {
     return(DocKey.DocIdToKeys(lightdoc.DocId));
 }