@@ -16,7 +16,12 @@ public AdaptAttributeBuilder(BaseAdaptAttribute attribute)
1616 this . Attribute = attribute ;
1717 }
1818
19- public AdaptAttributeBuilder ForTypes ( params Type [ ] types )
19+ /// <summary>
20+ /// Configures the builder for specific types.
21+ /// </summary>
22+ /// <param name="types">Types to configure.</param>
23+ /// <returns></returns>
24+ public AdaptAttributeBuilder ForTypes ( params Type [ ] types )
2025 {
2126 foreach ( var type in types )
2227 {
@@ -27,7 +32,14 @@ public AdaptAttributeBuilder ForTypes(params Type[] types)
2732 return this ;
2833 }
2934
30- public AdaptAttributeBuilder ForAllTypesInNamespace ( Assembly assembly , string @namespace )
35+
36+ /// <summary>
37+ /// Configures the builder for all types in a given namespace within an assembly.
38+ /// </summary>
39+ /// <param name="assembly">The assembly containing the types.</param>
40+ /// <param name="namespace">The namespace of the types to include.</param>
41+ /// <returns></returns>
42+ public AdaptAttributeBuilder ForAllTypesInNamespace ( Assembly assembly , string @namespace )
3143 {
3244 foreach ( var type in assembly . GetTypes ( ) )
3345 {
@@ -40,7 +52,14 @@ public AdaptAttributeBuilder ForAllTypesInNamespace(Assembly assembly, string @n
4052 return this ;
4153 }
4254
43- public AdaptAttributeBuilder ForType < T > ( Action < PropertySettingBuilder < T > > ? propertyConfig = null )
55+
56+ /// <summary>
57+ /// Configures the builder for a specific type and allows for property-specific configuration.
58+ /// </summary>
59+ /// <typeparam name="T"></typeparam>
60+ /// <param name="propertyConfig">An optional action for configuring properties of the specified type.</param>
61+ /// <returns></returns>
62+ public AdaptAttributeBuilder ForType < T > ( Action < PropertySettingBuilder < T > > ? propertyConfig = null )
4463 {
4564 if ( ! this . TypeSettings . TryGetValue ( typeof ( T ) , out var settings ) )
4665 {
@@ -52,7 +71,13 @@ public AdaptAttributeBuilder ForType<T>(Action<PropertySettingBuilder<T>>? prope
5271 return this ;
5372 }
5473
55- public AdaptAttributeBuilder ExcludeTypes ( params Type [ ] types )
74+
75+ /// <summary>
76+ /// Excludes specific types from the configuration.
77+ /// </summary>
78+ /// <param name="types">An array of types to exclude.</param>
79+ /// <returns></returns>
80+ public AdaptAttributeBuilder ExcludeTypes ( params Type [ ] types )
5681 {
5782 foreach ( var type in types )
5883 {
@@ -62,7 +87,13 @@ public AdaptAttributeBuilder ExcludeTypes(params Type[] types)
6287 return this ;
6388 }
6489
65- public AdaptAttributeBuilder ExcludeTypes ( Func < Type , bool > predicate )
90+
91+ /// <summary>
92+ /// Exclude certain types from the adaptation process based on a provided predicate.
93+ /// </summary>
94+ /// <param name="predicate">Predicate function should evaluate to true for types that you want to exclude from the mapping and false for types that should not be excluded.</param>
95+ /// <returns></returns>
96+ public AdaptAttributeBuilder ExcludeTypes ( Func < Type , bool > predicate )
6697 {
6798 foreach ( var type in this . TypeSettings . Keys . ToList ( ) )
6899 {
@@ -73,67 +104,135 @@ public AdaptAttributeBuilder ExcludeTypes(Func<Type, bool> predicate)
73104 return this ;
74105 }
75106
76- public AdaptAttributeBuilder IgnoreAttributes ( params Type [ ] attributes )
107+
108+ /// <summary>
109+ /// Specifies attributes to ignore during mapping.
110+ /// </summary>
111+ /// <param name="attributes">An array of attributes to ignore.</param>
112+ /// <returns></returns>
113+ public AdaptAttributeBuilder IgnoreAttributes ( params Type [ ] attributes )
77114 {
78115 this . Attribute . IgnoreAttributes = attributes ;
79116 return this ;
80117 }
81118
82- public AdaptAttributeBuilder IgnoreNoAttributes ( params Type [ ] attributes )
119+
120+ /// <summary>
121+ /// Specifies attributes that should not be ignored during mapping.
122+ /// </summary>
123+ /// <param name="attributes">An array of attributes that should not be ignored.</param>
124+ /// <returns></returns>
125+ public AdaptAttributeBuilder IgnoreNoAttributes ( params Type [ ] attributes )
83126 {
84127 this . Attribute . IgnoreNoAttributes = attributes ;
85128 return this ;
86129 }
87130
88- public AdaptAttributeBuilder IgnoreNamespaces ( params string [ ] namespaces )
131+
132+ /// <summary>
133+ /// Specifies namespaces to ignore during mapping.
134+ /// </summary>
135+ /// <param name="namespaces">An array of namespaces to ignore.</param>
136+ /// <returns></returns>
137+ public AdaptAttributeBuilder IgnoreNamespaces ( params string [ ] namespaces )
89138 {
90139 this . Attribute . IgnoreNamespaces = namespaces ;
91140 return this ;
92141 }
93142
94- public AdaptAttributeBuilder IgnoreNullValues ( bool value )
143+
144+ /// <summary>
145+ /// Configures whether null values should be ignored during mapping.
146+ /// </summary>
147+ /// <param name="value">A boolean value indicating whether to ignore null values.</param>
148+ /// <returns></returns>
149+ public AdaptAttributeBuilder IgnoreNullValues ( bool value )
95150 {
96151 this . Attribute . IgnoreNullValues = value ;
97152 return this ;
98153 }
99154
100- public AdaptAttributeBuilder RequireDestinationMemberSource ( bool value )
155+
156+ /// <summary>
157+ /// Configures whether a destination member source is required during.
158+ /// </summary>
159+ /// <param name="value">A boolean value indicating whether a destination member source is required.</param>
160+ /// <returns></returns>
161+ public AdaptAttributeBuilder RequireDestinationMemberSource ( bool value )
101162 {
102163 this . Attribute . RequireDestinationMemberSource = value ;
103164 return this ;
104165 }
105166
106- public AdaptAttributeBuilder MapToConstructor ( bool value )
167+
168+ /// <summary>
169+ /// Configures whether mapping should be performed to constructors.
170+ /// </summary>
171+ /// <param name="value">A boolean value indicating whether mapping to constructors is enabled.</param>
172+ /// <returns></returns>
173+ public AdaptAttributeBuilder MapToConstructor ( bool value )
107174 {
108175 this . Attribute . MapToConstructor = value ;
109176 return this ;
110177 }
111178
112- public AdaptAttributeBuilder MaxDepth ( int depth )
179+
180+ /// <summary>
181+ /// Sets the maximum depth for mapping.
182+ /// </summary>
183+ /// <param name="depth">The maximum depth for mapping.</param>
184+ /// <returns></returns>
185+ public AdaptAttributeBuilder MaxDepth ( int depth )
113186 {
114187 this . Attribute . MaxDepth = depth ;
115188 return this ;
116189 }
117-
118- public AdaptAttributeBuilder PreserveReference ( bool value )
190+
191+
192+ /// <summary>
193+ /// Configures whether to preserve object references during mapping.
194+ /// </summary>
195+ /// <param name="value">A boolean value indicating whether to preserve object references.</param>
196+ /// <returns></returns>
197+ public AdaptAttributeBuilder PreserveReference ( bool value )
119198 {
120199 this . Attribute . PreserveReference = value ;
121200 return this ;
122201 }
123-
124- public AdaptAttributeBuilder ShallowCopyForSameType ( bool value )
202+
203+
204+ /// <summary>
205+ /// Configures whether to perform a shallow copy for the same source and destination type.
206+ /// </summary>
207+ /// <param name="value">A boolean value indicating whether to perform a shallow copy.</param>
208+ /// <returns></returns>
209+ public AdaptAttributeBuilder ShallowCopyForSameType ( bool value )
125210 {
126211 this . Attribute . ShallowCopyForSameType = value ;
127212 return this ;
128213 }
129214
130- public AdaptAttributeBuilder AlterType < TFrom , TTo > ( )
215+
216+ /// <summary>
217+ /// Forward property types.
218+ /// </summary>
219+ /// <typeparam name="TFrom">Forward property from type.</typeparam>
220+ /// <typeparam name="TTo">Forward property to type.</typeparam>
221+ /// <returns></returns>
222+ public AdaptAttributeBuilder AlterType < TFrom , TTo > ( )
131223 {
132224 this . AlterTypes . Add ( type => type == typeof ( TFrom ) ? typeof ( TTo ) : null ) ;
133225 return this ;
134226 }
135227
136- public AdaptAttributeBuilder AlterType ( Func < Type , bool > predicate , Type toType )
228+
229+ /// <summary>
230+ /// Forward property types for Code generation.
231+ /// </summary>
232+ /// <param name="predicate">A function that takes a Type as input and returns a Boolean value. This function is used to evaluate whether the forward property should be applied to the target type. If the predicate returns true, the target type will be replaced; otherwise, it remains unchanged.</param>
233+ /// <param name="toType">Type of destination to forward property type.</param>
234+ /// <returns></returns>
235+ public AdaptAttributeBuilder AlterType ( Func < Type , bool > predicate , Type toType )
137236 {
138237 this . AlterTypes . Add ( type => predicate ( type ) ? toType : null ) ;
139238 return this ;
0 commit comments