Skip to content

Commit

Permalink
Fix FxCop warnings under Release
Browse files Browse the repository at this point in the history
  • Loading branch information
lewischeng-ms committed Oct 29, 2015
1 parent 1d0f0bf commit 14fdec3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
18 changes: 13 additions & 5 deletions src/Microsoft.Restier.EntityFramework/Model/ModelProducer.cs
Expand Up @@ -71,10 +71,7 @@ internal class ModelProducer : IModelBuilder
{ PrimitiveTypeKind.Time, EdmPrimitiveTypeKind.Duration }
};

static ModelProducer()
{
Instance = new ModelProducer();
}
private static IModelBuilder instance;

private ModelProducer()
{
Expand All @@ -83,7 +80,18 @@ private ModelProducer()
/// <summary>
/// Gets the single instance of this model producer.
/// </summary>
public static ModelProducer Instance { get; private set; }
public static IModelBuilder Instance
{
get
{
if (instance == null)
{
instance = new ModelProducer();
}

return instance;
}
}

/// <inheritdoc/>
public Task<IEdmModel> GetModelAsync(InvocationContext context, CancellationToken cancellationToken)
Expand Down
13 changes: 9 additions & 4 deletions src/Microsoft.Restier.WebApi/Routing/RestierRoutingConvention.cs
Expand Up @@ -115,13 +115,18 @@ private static bool IsMetadataPath(ODataPath odataPath)
ODataPathSegment firstSegment = odataPath.Segments.FirstOrDefault();
if (firstSegment != null)
{
if (firstSegment is EntitySetPathSegment)
var entitySetSegment = firstSegment as EntitySetPathSegment;
if (entitySetSegment != null)
{
controllerName = (firstSegment as EntitySetPathSegment).EntitySetName;
controllerName = entitySetSegment.EntitySetName;
}
else if (firstSegment is SingletonPathSegment)
else
{
controllerName = (firstSegment as SingletonPathSegment).SingletonName;
var singletonSegment = firstSegment as SingletonPathSegment;
if (singletonSegment != null)
{
controllerName = singletonSegment.SingletonName;
}
}
}

Expand Down

0 comments on commit 14fdec3

Please sign in to comment.