Esempio n. 1
0
        /// <summary>
        /// Crea oggetto del tipo definito senza schema (es. tipo lista)
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        internal object CreateDaoNoSchemaObj(Type type)
        {
            try
            {
                //Crea istanza
                ProxyEntryDao oTypeEntry = this.GetDaoEntry(type);

                //Istanzia
                object o = oTypeEntry.Create();

                //Ritorna
                return(o);
            }
            catch (KeyNotFoundException)
            {
                throw new TypeFactoryException("Tipo {0} non trovato. E' possibile che si siano verificati errori in fase di generazione schema.", type.Name);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    throw ex.InnerException;
                }
                else
                {
                    throw;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Crea un oggetto specificando se valorizzare o meno il dataschema
        /// </summary>
        /// <param name="type"></param>
        /// <param name="withData"></param>
        /// <returns></returns>
        internal object CreateDaoObj(Type type, bool withData)
        {
            try
            {
                //Crea istanza
                ProxyEntryDao oTypeEntry = this.GetDaoEntry(type);

                //Istanzia
                var o = oTypeEntry.Create() as DataObjectBase;

                //Imposta schema su oggetto
                o.mClassSchema = oTypeEntry.ClassSchema;
                o.ObjectRefId  = Interlocked.Increment(ref _ObjeRefIdCounter);

                if (withData)
                {
                    o.mDataSchema = new Schema.Usage.DataSchema(o.mClassSchema.Properties.Count, o.mClassSchema.ObjCount);
                }

                //Ritorna
                return(o);
            }
            catch (KeyNotFoundException)
            {
                throw new TypeFactoryException("Tipo {0} non trovato. E' possibile che si siano verificati errori in fase di generazione schema.", type.Name);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    throw ex.InnerException;
                }
                else
                {
                    throw;
                }
            }
        }