Ejemplo n.º 1
0
 public XUsingModel(IMemoryCache memory, XTypeConverter converter, X xx, IStringLocalizerFactory f)
 {
     cache          = memory;
     xtypeConverter = converter;
     x       = xx;
     factory = f;
 }
Ejemplo n.º 2
0
        public static XObject[] XFromForm(X x, XParameterInfo[] xparams, XTypeConverter xtypeConverter, IFormCollection form, _XThisCache cache)
        {
            List <XObject> values = new List <XObject>();

            if (xtypeConverter.XCanConvertFrom(typeof(string)))
            {
                XType _this = x.XTypeOf(typeof(_XThis));
                foreach (XParameterInfo xparameter in xparams)
                {
                    StringValues value   = form[xparameter.XName];
                    XObject      xobject = null;
                    if (xtypeConverter.XCanConvertTo(xparameter.XParameterType))
                    {
                        xobject = xtypeConverter.XConvertTo(value.ToString(), xparameter.XParameterType);
                    }
                    else if (cache != null)
                    {
                        if (xparameter.XParameterType.XIsAssignableFrom(cache.XThis.XGetType()))
                        {
                            XObject[] xattrs = xparameter.XGetCustomAttributes(_this, true);
                            if (xattrs != null && xattrs.Length > 0)
                            {
                                xobject = cache.XThis;
                            }
                        }

                        if (xobject == null)
                        {
                            if (value.ToString() == "")
                            {
                                xobject = x.XNULL;
                            }
                            else
                            {
                                xobject = _XObjectModel.XFromCache(cache, value.ToString());
                            }
                        }
                    }
                    values.Add(xobject);
                }
            }
            return(values.ToArray());
        }
Ejemplo n.º 3
0
 public XTypeModel(IMemoryCache memory, X xx, XTypeConverter converter)
 {
     cache      = memory;
     X          = xx;
     XConverter = converter;
 }
Ejemplo n.º 4
0
 public XNewModel(IMemoryCache c, X xx, XTypeConverter converter)
 {
     cache          = c;
     x              = xx;
     xtypeConverter = converter;
 }