Esempio n. 1
0
 public static void BulkMergeUtil <T>(List <T> list)
 {
     using (IDbConnection db = DBConnectionHelper.getConnection())
     {
         db.BulkMerge(list);
     }
 }
Esempio n. 2
0
 /*
  * This method simply merges whatever data is passed to it into DB
  */
 public static void updateURLs(Queue <URL> myUrlQueue)
 {
     using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig)){
         if (db != null)
         {
             db.BulkMerge(myUrlQueue);
         }
     }
 }
Esempio n. 3
0
        /*
         * This method simply merges whatever data is passed to it into DB
         */
        public static void updateURLs(Queue <URL> myUrlQueue)
        {
            String dbConfig = new MyConfigurationHelper().getDBConnectionConfig();

            using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig)){
                if (db != null)
                {
                    db.BulkMerge(myUrlQueue);
                }
            }
        }
Esempio n. 4
0
 //insert reviews in db
 public static void insertParsedReviews(List <Review> reviewsList)
 {
     if (reviewsList == null)
     {
         return;
     }
     if (reviewsList != null && reviewsList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig)){//get connection
             db.BulkMerge(reviewsList);
         }
     }
 }
Esempio n. 5
0
 public static void insertParsedApartmentList(List <Apartments> apartments)
 {
     if (apartments == null)
     {
         return;
     }
     if (apartments != null && apartments.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig))
         {//get connection
             db.BulkMerge(apartments);
         }
     }
 }
Esempio n. 6
0
 public static void insertParsedNTPI(List <NTPI> NtpiList)
 {
     if (NtpiList == null)
     {
         return;
     }
     if (NtpiList != null && NtpiList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig))
         {//get connection
             db.BulkMerge(NtpiList);
         }
     }
 }
Esempio n. 7
0
 public static void insertParsedSchools(List <School> schoolsList)
 {
     if (schoolsList == null)
     {
         return;
     }
     if (schoolsList != null && schoolsList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig))
         {//get connection
             db.BulkMerge(schoolsList);
         }
     }
 }
Esempio n. 8
0
 public static void insertParsedPropertyAmenities(List <Amenitytype> amenityTypeList)
 {
     if (amenityTypeList == null)
     {
         return;
     }
     if (amenityTypeList != null && amenityTypeList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig)) {//get connection
             db.BulkMerge(amenityTypeList)
             .ThenForEach(x => x.amenityList
                          .ForEach(y => y.amenitytype = x.id))
             .ThenBulkMerge(x => x.amenityList);
         }
     }
 }
Esempio n. 9
0
 public static void insertParsedExpenseType(List <Expensetype> expensesTypeList)
 {
     if (expensesTypeList == null)
     {
         return;
     }
     if (expensesTypeList != null && expensesTypeList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection(dbConfig)){ //get connection
             db.BulkMerge(expensesTypeList)                                     //insert the list of property types
             .ThenForEach(x => x.expensesList
                          .ForEach(y => y.expensetype = x.id))                  //set property type id for properties
             .ThenBulkMerge(x => x.expensesList);
         }
     }
 }
Esempio n. 10
0
 public static void insertParsedSchools(List <School> schoolsList)
 {
     if (schoolsList == null)
     {
         return;
     }
     if (schoolsList != null && schoolsList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection())
         {//get connection
             schoolsList.ForEach(x => x.id = getSchoolIdDb(x));
             db.BulkMerge(schoolsList)
             .ThenForEach(x => x.PropSchoolMapping
                          .ForEach(y => y.School = x.id))
             .ThenBulkMerge(x => x.PropSchoolMapping);
         }
     }
 }
Esempio n. 11
0
 public static void insertParsedNTPI(List <NTPICategory> NtpiCategoryList)
 {
     if (NtpiCategoryList == null)
     {
         return;
     }
     if (NtpiCategoryList != null && NtpiCategoryList.Count > 0)
     {
         using (IDbConnection db = DBConnectionHelper.getConnection())
         {//get connection
             NtpiCategoryList.ForEach(x => x.Id = getNtpiCategoryIdDb(x));
             db.BulkMerge(NtpiCategoryList)
             .ThenForEach(x => x.NtpiList.ForEach(y => y.NTPC = x.Id))
             .ThenBulkMerge(x => x.NtpiList)
             .ThenForEach(y => y.PropNTPIMapping.ForEach(z => z.NPTI = y.id))
             .ThenBulkMerge(y => y.PropNTPIMapping);
         }
     }
 }
Esempio n. 12
0
        /*
         * Method to insert parsed properties into DB
         */
        public void insertParsedProperties(PropertyData propData)
        {
            if (propData == null)
            {
                return;
            }
            List <PropertyType> propertyTypeList = propData.urlList;

            if (propertyTypeList != null && propertyTypeList.Count > 0)
            {
                using (IDbConnection db = DBConnectionHelper.getConnection()){ //get connection
                    db.BulkMerge(propertyTypeList)                             //insert the list of property types
                    .ThenForEach(x => x.properties
                                 .ForEach(y => y.propertytype = x.id))         //set property type id for properties
                    .ThenBulkMerge(x => x.properties)                          //insert properties
                    .ThenForEach(x => x.url.property = x.id)                   //set property id for urls
                    .ThenBulkMerge(x => x.url);                                //insert urls
                }
            }
        }
Esempio n. 13
0
 /// <summary>
 ///     An IDbConnection extension method to MERGE (Upsert) entities in a database table or a view.
 /// </summary>
 /// <typeparam name="T">Generic type parameter.</typeparam>
 /// <param name="connection">The connection to act on.</param>
 /// <param name="items">items to merge.</param>
 /// <param name="selectors">The selection of entities to merge.</param>
 /// <returns>A DapperPlusActionSet&lt;T&gt;</returns>
 public static DapperPlusActionSet <T> BulkMerge <T>(this IDbConnection connection, IEnumerable <T> items, params Func <T, object>[] selectors)
 {
     return(connection.BulkMerge(null, items, selectors));
 }
Esempio n. 14
0
 /// <summary>
 ///     An IDbConnection extension method to MERGE (Upsert) entities in a database table or a view.
 /// </summary>
 /// <typeparam name="T">Generic type parameter.</typeparam>
 /// <param name="connection">The connection to act on.</param>
 /// <param name="items">items to merge.</param>
 /// <returns>A DapperPlusActionSet&lt;T&gt;</returns>
 public static DapperPlusActionSet <T> BulkMerge <T>(this IDbConnection connection, params T[] items)
 {
     return(connection.BulkMerge <T>(null, items));
 }