예제 #1
0
 public static void BulkMergeUtil <T>(List <T> list)
 {
     using (IDbConnection db = DBConnectionHelper.getConnection())
     {
         db.BulkMerge(list);
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
                }
            }
        }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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
                }
            }
        }
예제 #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));
 }
예제 #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));
 }