private static string GetWhereClauseForObjectList(IHasIdentities foreignObjects) { // As above, but with a List<IHasIdentity> object. // Example: for an object of type People with Identities { 1337, 4711 }, this returns " PersonId IN (1337,4711) ". if (foreignObjects == null) { return(string.Empty); } int[] identities = foreignObjects.Identities; if (identities.Length == 0) { // No ids to match. Make sure that no record is returned by asking for identity 0, which doesn't exist identities = new int[1] { 0 }; } if (!(foreignObjects is IHasSingularPluralTypes)) { throw new ArgumentException("IHasIdentities object passed with missing IHasSingularPluralTypes interface"); } return(" " + GetForeignTypeString(((IHasSingularPluralTypes)foreignObjects).SingularType) + "Id IN (" + JoinIds(identities) + ") "); }
private static string GetWhereClauseForObjectList(IHasIdentities foreignObjects) { // As above, but with a List<IHasIdentity> object. // Example: for an object of type People with Identities { 1337, 4711 }, this returns " PersonId IN (1337,4711) ". if (foreignObjects == null) { return(string.Empty); } int[] identities = foreignObjects.Identities; if (identities.Length == 0) { // No ids to match. Make sure that no record is returned by asking for identity 0, which doesn't exist identities = new int[1] { 0 }; } return(" " + GetForeignTypeString(((List <IHasIdentity>)foreignObjects)[0]) + "Id IN (" + JoinIds(identities) + ") "); }
private static string GetWhereClauseForObjectList (IHasIdentities foreignObjects) { // As above, but with a List<IHasIdentity> object. // Example: for an object of type People with Identities { 1337, 4711 }, this returns " PersonId IN (1337,4711) ". if (foreignObjects == null) { return string.Empty; } int[] identities = foreignObjects.Identities; if (identities.Length == 0) { // No ids to match. Make sure that no record is returned by asking for identity 0, which doesn't exist identities = new int[1] { 0 }; } return " " + GetForeignTypeString(((List<IHasIdentity>)foreignObjects)[0]) + "Id IN (" + JoinIds(identities) + ") "; }