Lind.DDD.Repositories.Mongo Layer Introduction

Source: Internet
Author: User
Tags bulk insert

Back to Catalog

It's been happening before.

The older uncle had previously talked about the warehousing of MongoDB, And after the uncle developed the LIND.DDD, decided to move this thing to the storage layer of this framework, which is also the trend, after all, MongoDB is the most like relational database NoSQL, its use of the scene is other nosql can not, this is beyond doubt!

Below is the uncle's summary of the MongoDB article directory, selected from the Uncle MongoDB series >

MongoDB Learning Notes ~ Environment Construction (2015-03-30-10:34)

MongoDB Learning Note ~mongodbrepository Warehousing implementation (2015-04-08-12:00)

MongoDB Learning note ~objectid primary key design (2015-04-09-13:08)

MongoDB Learning Notes ~ Use of client command line (2015-04-10-13:40)

MongoDB Learning Notes ~ Indexing improves query efficiency (2015-04-10 15:35)

MongoDB Learning Note ~ Adding paging collection to the Imongorepository interface (2015-04-11-22:13)

MongoDB Learning note ~mongo cluster and replica set (2015-04-17 16:25)

MongoDB Learning Note ~ added sorting and expression tree for Imongorepository interface, for official driver (2015-04-27-22:11)

MongoDB Learning Notes ~ added additions and deletions to the Imongorepository interface for the official driver (2015-04-29-22:36)

MongoDB Learning Notes ~ Update specified fields for Imongorepository interface (2015-04-30-22:22)

MongoDB Learning Notes ~ Some things after the official drive integration IQueryable

MongoDB Learning Notes ~ Anonymous objects as query parameters, easy to query sub-objects

MongoDB Learning Note ~update method Update collection Properties after the strange problem

MongoDB Learning Notes ~ Implementation of BULK Insert method

MongoDB Learning Notes ~ Self-encapsulated curd operations (Querying collection object properties, updating collection objects)

MongoDB Learning Notes ~ Self-encapsulated curd operations (prerequisites for on-demand updates)

MongoDB Learning note ~mongodb value objects in an entity

MongoDB Learning Notes ~ Uncle Frame entity update support n-tier nesting ~ Recursive recursion I love you!

MongoDB Learning Notes ~ Uncle Share Bulk Add-bulk Update-Bulk Delete

MongoDB Learning Note ~mongovue querying, sorting, and displaying data on demand

MongoDB Learning Notes ~ Grouping implementations in pipelines group+distinct

MongoDB Learning Notes ~ official driven native curd operation

MongoDB Learning Note ~ Update of the official drive nested array object

MongoDB Learning Notes ~ Using native statements to implement updates for three-tier set relationships

MongoDB Learning Notes ~ What happens when the data structure is inconsistent with the entity object?

Storage module in LIND.DDD, MongoDB has a place

Uncle's MONGODB storage structure

When designing MongoDB queries and updates, the uncle used the recursive

  /// <summary>        ///Builders updated as needed///Recursive build Update operation string/// </summary>        /// <param name= "FieldList" ></param>        /// <param name= "property" ></param>        /// <param name= "PropertyValue" ></param>        /// <param name= "item" ></param>        /// <param name= "Fathervalue" ></param>        /// <param name= "father" ></param>        Private voidgeneraterecursionexpress (List<UpdateDefinition<TEntity>>FieldList, PropertyInfo property,ObjectPropertyValue, TEntity item,ObjectFathervalue,stringfather) {            //Complex Types            if(property. Propertytype.isclass && property. PropertyType! =typeof(string) && PropertyValue! =NULL)            {                //Collection                if(typeof(IList). IsAssignableFrom (Propertyvalue.gettype ())) {varModifyindex =0;//the record index to update                    foreach(varSubinchProperty. Propertytype.getproperties (BindingFlags.Instance |bindingflags.public)) {if(Sub. Propertytype.isclass && Sub. PropertyType! =typeof(string))                        {                            vararr = PropertyValue asIList; if(Arr! =NULL&& arr. Count >0)                            {                                varOldValue = property. GetValue (fathervalue?? item) asIList; if(OldValue! =NULL)                                {                                     for(intindex =0; Index < arr. Count; index++)                                    {                                         for(Modifyindex =0; Modifyindex < Oldvalue.count; modifyindex++)                                            if(Sub. Propertytype.getproperty (EntityKey). GetValue (Oldvalue[modifyindex]). ToString ()= = Sub. Propertytype.getproperty (EntityKey). GetValue (Arr[index]). ToString ())//Compare whether _id are equal                                                 Break; foreach(varSubinnerinchSub. Propertytype.getproperties (BindingFlags.Instance |bindingflags.public)) {if(string. Isnullorwhitespace (father)) generaterecursionexpress (FieldList, Subinner, S Ubinner.getvalue (Arr[index]), item, Arr[index], property. Name+"."+Modifyindex); Elsegeneraterecursionexpress (FieldList, Subinner, Subinner.getvalue (arr[in DEX]), item, Arr[index], Father+"."+ property. Name +"."+Modifyindex);                        }                                    }                                }                            } }                    }                }                //Entity                Else                {                    foreach(varSubinchProperty. Propertytype.getproperties (BindingFlags.Instance |bindingflags.public)) {if(string. Isnullorwhitespace (father)) Generaterecursionexpress (FieldList, sub, sub. GetValue (PropertyValue), item, property. GetValue (Fathervalue), property.                        Name); Elsegeneraterecursionexpress (FieldList, sub, sub.) GetValue (PropertyValue), item, property. GetValue (Fathervalue), Father+"."+Property .                    Name); }                }            }            //Simple Type            Else            {                if(property. Name! = EntityKey)//The update set cannot have entity keys _id                {                    if(string. Isnullorwhitespace (father)) Fieldlist.add (Builders<TEntity>. Update.set (property.                    Name, PropertyValue)); ElseFieldlist.add (Builders<tentity>. Update.set (Father +"."+Property .                Name, PropertyValue)); }            }        }

Let the code to change our lives, change our world!

Back to Catalog

Lind.DDD.Repositories.Mongo Layer Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.