Exemplo n.º 1
0
        public Func <System.Data.IDataReader, int, global::FormABC.Input[]> Find(Revenj.DatabasePersistence.Postgres.IBulkReadQuery query, IEnumerable <string> uris)
        {
            var sw    = query.Writer;
            var cms   = query.Stream;
            var count = uris != null?uris.Count() : 0;

            var pks = new List <string>(count);

            foreach (var _u in uris ?? new string[0])
            {
                if (_u != null)
                {
                    pks.Add(_u);
                }
            }
            if (pks.Count == 0)
            {
                sw.Write("SELECT 0");
                return((dr, ind) => new global::FormABC.Input[0]);
            }

            if (query.UsePrepared)
            {
                sw.Write(@"SELECT array_agg(_r) FROM ""FormABC"".""Input_entity"" _r WHERE _r.""ID"" = ANY(");
                var nextArg = query.GetNextArgument(wr =>
                {
                    wr.Write("ARRAY[");
                    PostgresRecordConverter.WriteSimpleUriList(wr, pks);
                    wr.Write("]::uuid[]");
                },
                                                    "uuid[]");
                sw.Write(nextArg);
                sw.Write(')');
            }
            else
            {
                sw.Write(@"SELECT array_agg(_r) FROM ""FormABC"".""Input_entity"" _r WHERE _r.""ID"" IN (");
                PostgresRecordConverter.WriteSimpleUriList(sw, pks);
                sw.Write(')');
            }
            return((dr, ind) =>
            {
                var result = new List <global::FormABC.Input>(pks.Count);
                var _pg = dr.GetValue(ind);
                var _str = _pg as string;
                if (_str != null)
                {
                    result.AddRange(PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_str), 0, Locator, _DatabaseCommon.FactoryFormABC_Input.InputConverter.CreateFromRecord));
                }
                else
                {
                    using (var _tr = _pg as System.IO.TextReader ?? new System.IO.StringReader(_pg.ToString()))
                        result.AddRange(PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_tr), 0, Locator, _DatabaseCommon.FactoryFormABC_Input.InputConverter.CreateFromRecord));
                }
                var found = result.ToArray();

                return found;
            });
        }
        public Func <System.Data.IDataReader, int, global::UseCase1.SubmissionList[]> Search(Revenj.DatabasePersistence.Postgres.IBulkReadQuery query, ISpecification <global::UseCase1.SubmissionList> specification, int?limit, int?offset)
        {
            var selectType = "SELECT array_agg(_r) FROM (SELECT _it as _r";
            var sw         = query.Writer;
            var cms        = query.Stream;

            if (specification == null)
            {
                sw.Write(@"SELECT array_agg(_r) FROM (SELECT _r FROM ""UseCase1"".""SubmissionList"" _r");
            }

            else
            {
                sw.Write("SELECT 0");
                return((dr, ind) => Search(specification, limit, offset));
            }
            sw.Write(" ORDER BY \"Customer\" ASC");
            if (limit != null && limit.Value >= 0)
            {
                sw.Write(" LIMIT ");
                sw.Write(limit.Value);
            }
            if (offset != null && offset.Value >= 0)
            {
                sw.Write(" OFFSET ");
                sw.Write(offset.Value);
            }
            sw.Write(@") _sq");
            return((dr, ind) =>
            {
                List <global::UseCase1.SubmissionList> result;
                var _pg = dr.GetValue(ind);
                var _str = _pg as string;
                if (_str != null)
                {
                    result = PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_str), 0, Locator, _DatabaseCommon.FactoryUseCase1_SubmissionList.SubmissionListConverter.CreateFromRecord);
                }
                else
                {
                    using (var _tr = _pg as System.IO.TextReader ?? new System.IO.StringReader(_pg.ToString()))
                        result = PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_tr), 0, Locator, _DatabaseCommon.FactoryUseCase1_SubmissionList.SubmissionListConverter.CreateFromRecord);
                }
                var found = result.ToArray();

                return found;
            });
        }
Exemplo n.º 3
0
        private void _InternalDoPersistStandard(Revenj.Utility.ChunkedMemoryStream cms, global::UseCase1.Customer[] insertedData, List <KeyValuePair <global::UseCase1.Customer, global::UseCase1.Customer> > updatedData, global::UseCase1.Customer[] deletedData)
        {
            var sw = cms.GetWriter();

            sw.Write("/*NO LOAD BALANCE*/SELECT \"UseCase1\".\"persist_Customer\"(");
            PostgresTypedArray.ToArray(sw, cms.SmallBuffer, insertedData, _DatabaseCommon.FactoryUseCase1_Customer.CustomerConverter.CreateTupleFrom);
            sw.Write(@"::""UseCase1"".""Customer_entity""[],");
            PostgresTypedArray.ToArray(sw, cms.SmallBuffer, updatedData.Select(it => it.Key), _DatabaseCommon.FactoryUseCase1_Customer.CustomerConverter.CreateTupleFrom);
            sw.Write(@"::""UseCase1"".""Customer_entity""[],");
            PostgresTypedArray.ToArray(sw, cms.SmallBuffer, updatedData.Select(it => it.Value), _DatabaseCommon.FactoryUseCase1_Customer.CustomerConverter.CreateTupleFrom);
            sw.Write(@"::""UseCase1"".""Customer_entity""[],");
            PostgresTypedArray.ToArray(sw, cms.SmallBuffer, deletedData, _DatabaseCommon.FactoryUseCase1_Customer.CustomerConverter.CreateTupleFrom);
            sw.Write(@"::""UseCase1"".""Customer_entity""[]");



            sw.Write(")");



            sw.Flush();
            cms.Position = 0;
            var    com       = PostgresCommandFactory.NewCommand(cms, "SELECT \"UseCase1\".\"persist_Customer\"(:insert,:update_old,:update_new,:delete)");
            string _sqlError = null;

            DatabaseQuery.Execute(com, dr => _sqlError = dr.GetString(0));
            if (_sqlError != null)
            {
                throw new PostgresException(_sqlError);
            }


            foreach (var item in insertedData)
            {
                item.__ResetChangeTracking();
            }
            foreach (var item in updatedData)
            {
                item.Value.__ResetChangeTracking();
            }
        }
Exemplo n.º 4
0
        public Func <System.Data.IDataReader, int, global::Test.XYZ[]> Search(Revenj.DatabasePersistence.Postgres.IBulkReadQuery query, ISpecification <global::Test.XYZ> specification, int?limit, int?offset)
        {
            var selectType = "SELECT array_agg(_r) FROM (SELECT _it as _r";
            var sw         = query.Writer;
            var cms        = query.Stream;

            if (specification == null)
            {
                sw.Write(@"SELECT array_agg(_r) FROM (SELECT _r FROM ""Test"".""XYZ_entity"" _r");
            }


            else if (specification is global::Test.XYZ.FindBy)
            {
                var spec = specification as global::Test.XYZ.FindBy;
                sw.Write(selectType);
                sw.Write(@" FROM ""Test"".""XYZ.FindBy""(");
                if (query.UsePrepared)
                {
                    sw.Write(query.GetNextArgument(tw =>
                    {
                        tw.Write('\'');
                        _DatabaseCommon.Utility.StringToTuple(spec.from).InsertRecord(tw, cms.SmallBuffer, string.Empty, PostgresTuple.EscapeQuote);
                        tw.Write('\'');
                        tw.Write("::varchar");
                    },
                                                   "varchar"));
                }
                else
                {
                    sw.Write('\'');
                    _DatabaseCommon.Utility.StringToTuple(spec.from).InsertRecord(sw, cms.SmallBuffer, string.Empty, PostgresTuple.EscapeQuote);
                    sw.Write('\'');
                }
                sw.Write(") _it");
            }
            else
            {
                sw.Write("SELECT 0");
                return((dr, ind) => Search(specification, limit, offset));
            }
            if (limit != null && limit.Value >= 0)
            {
                sw.Write(" LIMIT ");
                sw.Write(limit.Value);
            }
            if (offset != null && offset.Value >= 0)
            {
                sw.Write(" OFFSET ");
                sw.Write(offset.Value);
            }
            sw.Write(@") _sq");
            return((dr, ind) =>
            {
                List <global::Test.XYZ> result;
                var _pg = dr.GetValue(ind);
                var _str = _pg as string;
                if (_str != null)
                {
                    result = PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_str), 0, Locator, _DatabaseCommon.FactoryTest_XYZ.XYZConverter.CreateFromRecord);
                }
                else
                {
                    using (var _tr = _pg as System.IO.TextReader ?? new System.IO.StringReader(_pg.ToString()))
                        result = PostgresTypedArray.ParseCollection(cms.UseBufferedReader(_tr), 0, Locator, _DatabaseCommon.FactoryTest_XYZ.XYZConverter.CreateFromRecord);
                }
                var found = result.ToArray();

                return found;
            });
        }
Exemplo n.º 5
0
        internal static void InitializeProperties(System.Data.DataTable columnsInfo)
        {
            System.Data.DataRow row = null;

            ColumnCount         = columnsInfo.Select("type_schema = 'UseCase1' AND type_name = 'SelectedSubmission'").Length;
            ExtendedColumnCount = columnsInfo.Select("type_schema = 'UseCase1' AND type_name = '-ngs_SelectedSubmission_type-'").Length;

            ReaderConfiguration         = new Action <global::UseCase1.SelectedSubmission, Revenj.Utility.BufferedTextReader, int, IServiceProvider> [ColumnCount > 0 ? ColumnCount: 1];
            ReaderExtendedConfiguration = new Action <global::UseCase1.SelectedSubmission, Revenj.Utility.BufferedTextReader, int, IServiceProvider> [ExtendedColumnCount > 0 ? ExtendedColumnCount: 1];
            for (int i = 0; i < ColumnCount; i++)
            {
                ReaderConfiguration[i] = (agg, tr, c, sl) => StringConverter.Skip(tr, c);
            }
            if (ColumnCount != ReaderConfiguration.Length)
            {
                ReaderConfiguration[0] = (agg, tr, c, sl) => tr.Read();
            }
            for (int i = 0; i < ExtendedColumnCount; i++)
            {
                ReaderExtendedConfiguration[i] = (agg, tr, c, sl) => StringConverter.Skip(tr, c);
            }
            if (ExtendedColumnCount != ReaderExtendedConfiguration.Length)
            {
                ReaderExtendedConfiguration[0] = (agg, tr, c, sl) => tr.Read();
            }


            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "URI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column URI in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_URI_Index = (short)row["column_index"] - 1;


            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "URI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column URI in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_URI_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_URI_Index] = (item, reader, context, locator) => item.URI = StringConverter.Parse(reader, context);

            ReaderExtendedConfiguration[ExtendedProperty_URI_Index] = (item, reader, context, locator) => item.URI = StringConverter.Parse(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Customer" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Customer in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Customer_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Customer_Index] = (item, reader, context, locator) => item._Customer = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Customer" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Customer in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Customer_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Customer_Index] = (item, reader, context, locator) => item._Customer = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Form" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Form in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Form_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Form_Index] = (item, reader, context, locator) => item._Form = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Form" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Form in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Form_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Form_Index] = (item, reader, context, locator) => item._Form = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Schema" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Schema in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Schema_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Schema_Index] = (item, reader, context, locator) => item._Schema = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Schema" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Schema in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Schema_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Schema_Index] = (item, reader, context, locator) => item._Schema = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "FormInputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column FormInputs in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_FormInputs_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_FormInputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromRecord); if (__list != null)
                                                                                                   {
                                                                                                       item._FormInputs = __list;
                                                                                                   }
                                                                                                   else
                                                                                                   {
                                                                                                       item._FormInputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                                   } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "FormInputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column FormInputs in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_FormInputs_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_FormInputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromExtendedRecord); if (__list != null)
                                                                                                                   {
                                                                                                                       item._FormInputs = __list;
                                                                                                                   }
                                                                                                                   else
                                                                                                                   {
                                                                                                                       item._FormInputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                                                   } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Group" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Group in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Group_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Group_Index] = (item, reader, context, locator) => item._Group = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Group" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Group in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Group_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Group_Index] = (item, reader, context, locator) => item._Group = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Comments" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Comments in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Comments_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Comments_Index] = (item, reader, context, locator) => item._Comments = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Comments" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Comments in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Comments_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Comments_Index] = (item, reader, context, locator) => item._Comments = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "SelectedSubmission", "Date" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Date in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            Property_Date_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Date_Index] = (item, reader, context, locator) => item._Date = _DatabaseCommon.Utility.ParseTimestamp(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_SelectedSubmission_type-", "Date" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Date in type UseCase1.SelectedSubmission. Check if database is out of sync with code");
            }
            ExtendedProperty_Date_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Date_Index] = (item, reader, context, locator) => item._Date = _DatabaseCommon.Utility.ParseTimestamp(reader, context);
        }
        internal static void InitializeProperties(System.Data.DataTable columnsInfo)
        {
            System.Data.DataRow row = null;

            ColumnCount         = columnsInfo.Select("type_schema = 'UseCase1' AND type_name = 'Form_entity'").Length;
            ExtendedColumnCount = columnsInfo.Select("type_schema = 'UseCase1' AND type_name = '-ngs_Form_type-'").Length;

            ReaderConfiguration         = new Action <global::UseCase1.Form, Revenj.Utility.BufferedTextReader, int, IServiceProvider> [ColumnCount > 0 ? ColumnCount: 1];
            ReaderExtendedConfiguration = new Action <global::UseCase1.Form, Revenj.Utility.BufferedTextReader, int, IServiceProvider> [ExtendedColumnCount > 0 ? ExtendedColumnCount: 1];
            for (int i = 0; i < ColumnCount; i++)
            {
                ReaderConfiguration[i] = (agg, tr, c, sl) => StringConverter.Skip(tr, c);
            }
            if (ColumnCount != ReaderConfiguration.Length)
            {
                ReaderConfiguration[0] = (agg, tr, c, sl) => tr.Read();
            }
            for (int i = 0; i < ExtendedColumnCount; i++)
            {
                ReaderExtendedConfiguration[i] = (agg, tr, c, sl) => StringConverter.Skip(tr, c);
            }
            if (ExtendedColumnCount != ReaderExtendedConfiguration.Length)
            {
                ReaderExtendedConfiguration[0] = (agg, tr, c, sl) => tr.Read();
            }


            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "ID" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column ID in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_ID_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_ID_Index] = (item, reader, context, locator) => item._ID = _DatabaseCommon.Utility.ParseGuid(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "ID" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column ID in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_ID_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_ID_Index] = (item, reader, context, locator) => item._ID = _DatabaseCommon.Utility.ParseGuid(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "Name" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Name in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_Name_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Name_Index] = (item, reader, context, locator) => item._Name = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "Name" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Name in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_Name_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Name_Index] = (item, reader, context, locator) => item._Name = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "Schema" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Schema in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_Schema_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Schema_Index] = (item, reader, context, locator) => item._Schema = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "Schema" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Schema in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_Schema_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Schema_Index] = (item, reader, context, locator) => item._Schema = _DatabaseCommon.Utility.ParseString(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "GroupURI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column GroupURI in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_GroupURI_Index = (short)row["column_index"] - 1;


            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "GroupURI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column GroupURI in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_GroupURI_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_GroupURI_Index] = (item, reader, context, locator) => item._GroupURI = StringConverter.Parse(reader, context);

            ReaderExtendedConfiguration[ExtendedProperty_GroupURI_Index] = (item, reader, context, locator) => item._GroupURI = StringConverter.Parse(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "GroupID" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column GroupID in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_GroupID_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_GroupID_Index] = (item, reader, context, locator) => item._GroupID = _DatabaseCommon.Utility.ParseGuid(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "GroupID" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column GroupID in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_GroupID_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_GroupID_Index] = (item, reader, context, locator) => item._GroupID = _DatabaseCommon.Utility.ParseGuid(reader, context);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "Status" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Status in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_Status_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Status_Index] = (item, reader, context, locator) => item._Status = _DatabaseCommon.FactoryUseCase1_FormStatus.FormStatusConverter.ParseFromPostgres(reader);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "Status" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Status in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_Status_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Status_Index] = (item, reader, context, locator) => item._Status = _DatabaseCommon.FactoryUseCase1_FormStatus.FormStatusConverter.ParseFromPostgres(reader);

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "Inputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Inputs in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_Inputs_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Inputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromRecord); if (__list != null)
                                                                                               {
                                                                                                   item._Inputs = __list;
                                                                                               }
                                                                                               else
                                                                                               {
                                                                                                   item._Inputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                               } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "Inputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Inputs in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_Inputs_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Inputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromExtendedRecord); if (__list != null)
                                                                                                               {
                                                                                                                   item._Inputs = __list;
                                                                                                               }
                                                                                                               else
                                                                                                               {
                                                                                                                   item._Inputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                                               } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "Outputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Outputs in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_Outputs_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_Outputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromRecord); if (__list != null)
                                                                                                {
                                                                                                    item._Outputs = __list;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    item._Outputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                                } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "Outputs" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column Outputs in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_Outputs_Index = (short)row["column_index"] - 1;


            ReaderExtendedConfiguration[ExtendedProperty_Outputs_Index] = (item, reader, context, locator) => { var __list = PostgresTypedArray.ParseCollection(reader, context, locator, _DatabaseCommon.FactoryUseCase1_Entry.EntryConverter.CreateFromExtendedRecord); if (__list != null)
                                                                                                                {
                                                                                                                    item._Outputs = __list;
                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    item._Outputs = new System.Collections.Generic.List <global::UseCase1.Entry>();
                                                                                                                } };

            row = columnsInfo.Rows.Find(new[] { "UseCase1", "Form_entity", "SubmissionsURI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column SubmissionsURI in type UseCase1.Form_entity. Check if database is out of sync with code");
            }
            Property_SubmissionsURI_Index = (short)row["column_index"] - 1;


            row = columnsInfo.Rows.Find(new[] { "UseCase1", "-ngs_Form_type-", "SubmissionsURI" });
            if (row == null)
            {
                throw new System.Configuration.ConfigurationException("Couldn't find column SubmissionsURI in type UseCase1.Form. Check if database is out of sync with code");
            }
            ExtendedProperty_SubmissionsURI_Index = (short)row["column_index"] - 1;


            ReaderConfiguration[Property_SubmissionsURI_Index] = (item, reader, context, locator) => { var __list = StringConverter.ParseCollection(reader, context, true); if (__list != null)
                                                                                                       {
                                                                                                           item._SubmissionsURI = __list.ToArray();
                                                                                                       }
                                                                                                       else
                                                                                                       {
                                                                                                           item._SubmissionsURI = new string[0];
                                                                                                       } };

            ReaderExtendedConfiguration[ExtendedProperty_SubmissionsURI_Index] = (item, reader, context, locator) => { var __list = StringConverter.ParseCollection(reader, context, true); if (__list != null)
                                                                                                                       {
                                                                                                                           item._SubmissionsURI = __list.ToArray();
                                                                                                                       }
                                                                                                                       else
                                                                                                                       {
                                                                                                                           item._SubmissionsURI = new string[0];
                                                                                                                       } };


            TableTuples                                = new bool[ColumnCount];
            PrimaryKeyUpdateTuples                     = new bool[ColumnCount];
            PrimaryKeyDeleteTuples                     = new bool[ColumnCount];
            TableTuples[Property_ID_Index]             = true;
            TableTuples[Property_Name_Index]           = true;
            TableTuples[Property_Schema_Index]         = true;
            TableTuples[Property_GroupID_Index]        = true;
            TableTuples[Property_Status_Index]         = true;
            TableTuples[Property_Inputs_Index]         = true;
            TableTuples[Property_Outputs_Index]        = true;
            TableTuples[Property_SubmissionsURI_Index] = true;

            PrimaryKeyUpdateTuples[Property_ID_Index] = true;
            PrimaryKeyDeleteTuples[Property_ID_Index] = true;
        }
Exemplo n.º 7
0
 public static List <S3> ParseCollection(BufferedTextReader reader, int context)
 {
     return(PostgresTypedArray.ParseCollection(reader, context, null, ParseS3));
 }