Skip to content

Commit

Permalink
Merge branch 'typedcollections' into clientjoin
Browse files Browse the repository at this point in the history
Conflicts:
	source/MongoDB.Tests/IntegrationTests/Linq/MongoQueryTests.cs
  • Loading branch information
craiggwilson committed May 1, 2010
2 parents 0d4e26d + 0e2dfe6 commit 534c740
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Expand Up @@ -362,4 +362,4 @@ public void Join()
Assert.AreEqual(0, people.Count);
}
}
}
}
2 changes: 1 addition & 1 deletion source/MongoDB.Tests/IntegrationTests/TestCollection_1.cs
Expand Up @@ -276,7 +276,7 @@ private class DeletesEntity
};
inserts.Insert(album);

var result = inserts.FindOne(new Document().Add("songs.title", "Deliveries After Dark"));
var result = inserts.FindOne(new Document().Add("Songs.Title", "Deliveries After Dark"));
Assert.IsNotNull(result);

Assert.AreEqual(album.Songs.Count, result.Songs.Count);
Expand Down
Expand Up @@ -81,14 +81,20 @@ protected PersistentMemberMap GetMemberMapFromMemberName(string name)

var parts = name.Split('.');
memberMap = ClassMap.GetMemberMapFromMemberName(parts[0]);
if (memberMap == null)
return null;

var currentType = memberMap.MemberReturnType;
for (int i = 1; i < parts.Length && memberMap != null; i++)
{
if (IsNumeric(parts[i])) //we are an array indexer
var collectionMemberMap = memberMap as CollectionMemberMap;
if (collectionMemberMap != null)
{
currentType = ((CollectionMemberMap)memberMap).ElementType;
continue;
if (IsNumeric(parts[i])) //we are an array indexer
continue;
}

var classMap = _mappingStore.GetClassMap(currentType);
memberMap = classMap.GetMemberMapFromAlias(parts[i]);
if (memberMap != null)
Expand Down Expand Up @@ -136,11 +142,15 @@ protected string GetAliasFromMemberName(string name)
{
if(memberMap != null)
{
if (IsNumeric(parts[i])) //we are an array indexer
var collectionMemberMap = memberMap as CollectionMemberMap;
if (collectionMemberMap != null)
{
currentType = ((CollectionMemberMap)memberMap).ElementType;
sb.Append(".").Append(parts[i]);
continue;
if (IsNumeric(parts[i])) //we are an array indexer
{
sb.Append(".").Append(parts[i]);
continue;
}
}

var classMap = _mappingStore.GetClassMap(currentType);
Expand Down

0 comments on commit 534c740

Please sign in to comment.