Skip to content

Commit

Permalink
Remove nullability from mutable Add methods
Browse files Browse the repository at this point in the history
And FinalizeModel
  • Loading branch information
roji committed Oct 30, 2020
1 parent b93bcb5 commit eb4bb1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/EFCore/Extensions/MutableEntityTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static IEnumerable<IMutableIndex> GetDeclaredIndexes([NotNull] this IMuta
/// <param name="entityType"> The entity type. </param>
/// <param name="property"> The property to use as an alternate key. </param>
/// <returns> The newly created key. </returns>
public static IMutableKey? AddKey(
public static IMutableKey AddKey(
[NotNull] this IMutableEntityType entityType,
[NotNull] IMutableProperty property)
=> Check.NotNull(entityType, nameof(entityType)).AddKey(new[] { property });
Expand Down Expand Up @@ -316,7 +316,7 @@ public static IEnumerable<IMutableForeignKey> GetDeclaredReferencingForeignKeys(
/// base type of the hierarchy).
/// </param>
/// <returns> The newly created foreign key. </returns>
public static IMutableForeignKey? AddForeignKey(
public static IMutableForeignKey AddForeignKey(
[NotNull] this IMutableEntityType entityType,
[NotNull] IMutableProperty property,
[NotNull] IMutableKey principalKey,
Expand Down Expand Up @@ -453,7 +453,7 @@ public static IEnumerable<IMutableNavigation> GetNavigations([NotNull] this IMut
/// <param name="entityType"> The entity type. </param>
/// <param name="memberInfo"> The corresponding member on the entity class. </param>
/// <returns> The newly created property. </returns>
public static IMutableProperty? AddProperty(
public static IMutableProperty AddProperty(
[NotNull] this IMutableEntityType entityType,
[NotNull] MemberInfo memberInfo)
=> Check.NotNull(entityType, nameof(entityType))
Expand All @@ -465,10 +465,10 @@ public static IEnumerable<IMutableNavigation> GetNavigations([NotNull] this IMut
/// <param name="entityType"> The entity type. </param>
/// <param name="name"> The name of the property to add. </param>
/// <returns> The newly created property. </returns>
public static IMutableProperty? AddProperty(
public static IMutableProperty AddProperty(
[NotNull] this IMutableEntityType entityType,
[NotNull] string name)
=> ((EntityType)entityType).AddProperty(name, ConfigurationSource.Explicit);
=> ((EntityType)entityType).AddProperty(name, ConfigurationSource.Explicit)!;

/// <summary>
/// Adds a property to this entity type.
Expand All @@ -477,11 +477,11 @@ public static IEnumerable<IMutableNavigation> GetNavigations([NotNull] this IMut
/// <param name="name"> The name of the property to add. </param>
/// <param name="propertyType"> The type of value the property will hold. </param>
/// <returns> The newly created property. </returns>
public static IMutableProperty? AddProperty(
public static IMutableProperty AddProperty(
[NotNull] this IMutableEntityType entityType,
[NotNull] string name,
[NotNull] Type propertyType)
=> ((EntityType)entityType).AddProperty(name, propertyType, ConfigurationSource.Explicit, ConfigurationSource.Explicit);
=> ((EntityType)entityType).AddProperty(name, propertyType, ConfigurationSource.Explicit, ConfigurationSource.Explicit)!;

/// <summary>
/// Adds a property backed up by an indexer to this entity type.
Expand All @@ -490,7 +490,7 @@ public static IEnumerable<IMutableNavigation> GetNavigations([NotNull] this IMut
/// <param name="name"> The name of the property to add. </param>
/// <param name="propertyType"> The type of value the property will hold. </param>
/// <returns> The newly created property. </returns>
public static IMutableProperty? AddIndexerProperty(
public static IMutableProperty AddIndexerProperty(
[NotNull] this IMutableEntityType entityType,
[NotNull] string name,
[NotNull] Type propertyType)
Expand Down Expand Up @@ -526,7 +526,7 @@ public static IEnumerable<IMutableNavigation> GetNavigations([NotNull] this IMut
/// <param name="entityType"> The entity type. </param>
/// <param name="property"> The property to be indexed. </param>
/// <returns> The newly created index. </returns>
public static IMutableIndex? AddIndex(
public static IMutableIndex AddIndex(
[NotNull] this IMutableEntityType entityType,
[NotNull] IMutableProperty property)
=> Check.NotNull(entityType, nameof(entityType)).AddIndex(new[] { property });
Expand Down
8 changes: 4 additions & 4 deletions src/EFCore/Extensions/MutableModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public static void SetChangeTrackingStrategy(
/// <param name="model"> The model to add the ignored type to. </param>
/// <param name="type"> The entity type to be ignored. </param>
/// <returns> The name of the ignored type. </returns>
public static string? AddIgnored([NotNull] this IMutableModel model, [NotNull] Type type)
public static string AddIgnored([NotNull] this IMutableModel model, [NotNull] Type type)
=> Check.NotNull((Model)model, nameof(model)).AddIgnored(
Check.NotNull(type, nameof(type)), ConfigurationSource.Explicit);
Check.NotNull(type, nameof(type)), ConfigurationSource.Explicit)!;

/// <summary>
/// Returns a value indicating whether the entity types using the given type should be configured
Expand Down Expand Up @@ -262,7 +262,7 @@ public static void AddShared([NotNull] this IMutableModel model, [NotNull] Type
/// </summary>
/// <param name="model"> The model to finalize. </param>
/// <returns> The finalized <see cref="IModel" />. </returns>
public static IModel? FinalizeModel([NotNull] this IMutableModel model)
=> ((Model)model).FinalizeModel();
public static IModel FinalizeModel([NotNull] this IMutableModel model)
=> ((Model)model).FinalizeModel()!;
}
}

0 comments on commit eb4bb1c

Please sign in to comment.