Skip to content

Commit f19aebc

Browse files
authored
Use expression bodied properties (#653)
+semver:patch
1 parent 32c9788 commit f19aebc

File tree

138 files changed

+857
-3120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+857
-3120
lines changed

src/FluentNHibernate.Specs.ExternalFixtures/Entity.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ public class Entity
1515

1616
public enum TestEnum {}
1717

18-
public EntityChild ReadOnlyChild
19-
{
20-
get { return readOnlyChild; }
21-
}
18+
public EntityChild ReadOnlyChild => readOnlyChild;
2219
}
2320

2421
public class EntityChild

src/FluentNHibernate.Specs/Automapping/Fixtures/ReadOnlyEnumerableEntity.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@ class ReadOnlyEnumerableEntity
99

1010
public int Id { get; set; }
1111
public IEnumerable<EntityChild> AutoPropertyCollection { get; private set; }
12-
public IEnumerable<EntityChild> BackingFieldCollection
13-
{
14-
get { return backingFieldCollection; }
15-
}
12+
public IEnumerable<EntityChild> BackingFieldCollection => backingFieldCollection;
1613
}

src/FluentNHibernate.Specs/Automapping/Fixtures/UserTypes.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,9 @@ public SqlType[] SqlTypes
102102
get { return new[] { new SqlType(DbType.String) }; }
103103
}
104104

105-
public Type ReturnedType
106-
{
107-
get { return typeof(CustomUserType); }
108-
}
105+
public Type ReturnedType => typeof(CustomUserType);
109106

110-
public bool IsMutable
111-
{
112-
get { return true; }
113-
}
107+
public bool IsMutable => true;
114108
}
115109

116110
public struct UserValueType : IUserType
@@ -169,6 +163,6 @@ public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplemen
169163
}
170164

171165
public SqlType[] SqlTypes { get; private set; }
172-
public Type ReturnedType { get { return typeof(UserValueType); } }
166+
public Type ReturnedType => typeof(UserValueType);
173167
public bool IsMutable { get; private set; }
174168
}

src/FluentNHibernate.Specs/FluentInterface/ClassMapSpecs/ClassMapSpecs.Id.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class when_class_map_is_told_to_map_an_id_without_a_property_or_column :
3030

3131
static ClassMapping mapping;
3232

33-
static IdMapping Id { get { return mapping.Id as IdMapping; }}
33+
static IdMapping Id => mapping.Id as IdMapping;
3434
}
3535

3636
public class when_class_map_has_a_composite_id_with_a_key_reference_with_multiple_columns : ProviderSpec

src/FluentNHibernate.Testing/AutoMapping/TestFixtures.cs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ public class ExampleCustomColumn
4343
{
4444
public int Id { get; set; }
4545
public int ExampleCustomColumnId { get; set; }
46-
public int CustomColumn
47-
{
48-
get
49-
{
50-
return 12;
51-
}
52-
}
46+
public int CustomColumn => 12;
5347
}
5448

5549
public class ExampleInheritedClass : ExampleClass
@@ -306,26 +300,17 @@ public SqlType[] SqlTypes
306300
get { return new[] {new SqlType(DbType.String)}; }
307301
}
308302

309-
public Type ReturnedType
310-
{
311-
get { return typeof(Custom); }
312-
}
303+
public Type ReturnedType => typeof(Custom);
313304

314-
public bool IsMutable
315-
{
316-
get { return true; }
317-
}
305+
public bool IsMutable => true;
318306
}
319307
}
320308

321309
namespace FluentNHibernate.Automapping.TestFixtures.CustomCompositeTypes
322310
{
323311
public class DoubleStringType : ICompositeUserType
324312
{
325-
public System.Type ReturnedClass
326-
{
327-
get { return typeof(string[]); }
328-
}
313+
public System.Type ReturnedClass => typeof(string[]);
329314

330315
public new bool Equals(object x, object y)
331316
{
@@ -357,10 +342,7 @@ public Object DeepCopy(Object x)
357342
return result;
358343
}
359344

360-
public bool IsMutable
361-
{
362-
get { return true; }
363-
}
345+
public bool IsMutable => true;
364346

365347
public object NullSafeGet(DbDataReader dr, string[] names, ISessionImplementor session, object owner)
366348
{
@@ -431,13 +413,7 @@ public class SuperType
431413
public class ExampleCustomColumn : SuperType
432414
{
433415
public int ExampleCustomColumnId { get; set; }
434-
public int CustomColumn
435-
{
436-
get
437-
{
438-
return 12;
439-
}
440-
}
416+
public int CustomColumn => 12;
441417
}
442418

443419
public class ExampleInheritedClass : ExampleClass

src/FluentNHibernate.Testing/Cfg/Db/CacheSettingsBuilderTester.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ private void HasProperty(string key, string value)
111111

112112
private class CacheSettingsBuilderDouble : CacheSettingsBuilder
113113
{
114-
public IDictionary<string, string> Properties
115-
{
116-
get { return Create(); }
117-
}
114+
public IDictionary<string, string> Properties => Create();
118115
}
119116
}

src/FluentNHibernate.Testing/Cfg/Db/ConnectionStringBuilderTester.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public void ConnectionStringSetFromConnectionStrings()
4141

4242
private class ConnectionStringBuilderDouble : ConnectionStringBuilder
4343
{
44-
public string ConnectionString
45-
{
46-
get { return Create(); }
47-
}
44+
public string ConnectionString => Create();
4845
}
4946
}

src/FluentNHibernate.Testing/ConventionsTests/RunnableConventionsTests.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -692,18 +692,11 @@ public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplemen
692692
throw new NotImplementedException();
693693
}
694694

695-
public SqlType[] SqlTypes
696-
{
697-
get { return null; }
698-
}
699-
public Type ReturnedType
700-
{
701-
get { return typeof(OtherObject); }
702-
}
703-
public bool IsMutable
704-
{
705-
get { return false; }
706-
}
695+
public SqlType[] SqlTypes => null;
696+
697+
public Type ReturnedType => typeof(OtherObject);
698+
699+
public bool IsMutable => false;
707700
}
708701

709702
#endregion

src/FluentNHibernate.Testing/DomainModel/Mapping/ComponentPropertyMapTester.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,11 @@ public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplemen
257257
throw new NotImplementedException();
258258
}
259259

260-
public SqlType[] SqlTypes
261-
{
262-
get { return null; }
263-
}
260+
public SqlType[] SqlTypes => null;
264261

265-
public Type ReturnedType
266-
{
267-
get { return null; }
268-
}
262+
public Type ReturnedType => null;
269263

270-
public bool IsMutable
271-
{
272-
get { return false; }
273-
}
264+
public bool IsMutable => false;
274265
}
275266
#endregion
276267
}

src/FluentNHibernate.Testing/DomainModel/Mapping/OneToManyTester.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public class OneToManyTarget
4343
public virtual IList<ChildObject> GetOtherChildren() { return otherChildren; }
4444

4545
private IList<ChildObject> listToArrayChild = new List<ChildObject>();
46-
public virtual ChildObject[] ListToArrayChild { get { return listToArrayChild.ToArray(); } }
47-
46+
public virtual ChildObject[] ListToArrayChild => listToArrayChild.ToArray();
4847
}
4948

5049
public class ValueObject

0 commit comments

Comments
 (0)