Closed GoogleCodeExporter closed 9 years ago
Original comment by alexey.g...@gtempaccount.com
on 11 Oct 2010 at 10:34
4.3.5@13.10.2010
System.InvalidCastException occurred
Message=Unable to cast object of type 'System.Guid' to type 'System.String'.
Source=Xtensive.Core
StackTrace:
at Xtensive.Core.Tuples.Tuple.GetValueOrDefaultInternal[T](Boolean isNullable, Int32 fieldIndex) in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Tuples\Tuple.cs:line 275
at Xtensive.Core.Tuples.Tuple.GetValueOrDefault[T](Int32 fieldIndex) in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Tuples\Tuple.cs:line 189
at lambda_method(Closure , Object[] , Tuple , ItemMaterializationContext )
at Xtensive.Core.DelegateBindExtensions.<>c__DisplayClassa`4.<Bind>b__9(T2 arg2, T3 arg3) in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Extensions\DelegateBindExtensions.cs:line 46
at Xtensive.Storage.Linq.Materialization.MaterializationHelper.<>c__DisplayClass4`1.<Materialize>b__3(Tuple tuple) in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage\Linq\Materialization\MaterializationHelper.cs:line 117
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at Xtensive.Core.EnumerableExtensions.<Batch>d__20`1.MoveNext() in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Extensions\EnumerableExtensions.cs:line 498
at Xtensive.Core.EnumerableExtensions.<ApplyBeforeAndAfter>d__28`1.MoveNext() in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Extensions\EnumerableExtensions.cs:line 594
at Xtensive.Storage.TransactionalExtensions.<ToTransactional>d__0`1.MoveNext() in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage\TransactionalExtensions.cs:line 327
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Xtensive.Storage.Linq.SubQuery`1.MaterializeSelf() in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage\Linq\SubQuery.cs:line 67
at Xtensive.Storage.Linq.Materialization.MaterializationHelper.BatchActivator.Deactivate() in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage\Linq\Materialization\MaterializationHelper.cs:line 53
at Xtensive.Core.EnumerableExtensions.<ApplyBeforeAndAfter>d__28`1.MoveNext() in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Extensions\EnumerableExtensions.cs:line 600
at Xtensive.Storage.TransactionalExtensions.<ToTransactional>d__0`1.MoveNext() in c:\Temp\DataObjects.Net\Xtensive.Storage\Xtensive.Storage\TransactionalExtensions.cs:line 327
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Werp.Controller.Repository.Cache.DynamicFilterByOwnerSourceField.RefreshCache() in D:\Home\Docs\Visual Studio 2010\Projects\Platform\Werp.Controller.Repository\Cache\DynamicFilterByOwnerSourceField.cs:line 70
InnerException:
Original comment by v.tambov...@gmail.com
on 13 Oct 2010 at 11:00
var q = from tpf in Query.All<DynamicField.TpDynamicFilter>()
group tpf by tpf.Owner.SourceField.Id
into gr
select new
{
K = gr.Key,
V = gr.Select(a => new DynamicFilterInfo()
{
Id = a.Id,
OwnerSourceFieldId = a.Owner.SourceField.Id,
Value = a.Value,
CheckNulls = a.CheckNulls,
SourceSysName = a.Source != null ? a.Source.SysName : null,
FilteredSysName = a.Filtered != null ? a.Filtered.SysName : null,
ExtendedFiltered = a.ExtendedFiltered,
ExtendedSource = a.ExtendedSource,
SourceLinkedEntitySysName =
a.Source != null ? a.Source.LinkedEntity.SysName : null,
Condition = a.Condition.Id
})
};
return q.ToDictionary(a => a.K, b => b.V.ToList());
public class DynamicFilterInfo
{
/// <summary>Gets or sets Id.</summary>
public Guid Id { get; set; }
/// <summary>Gets or sets OwnerSourceFieldId.</summary>
public Guid OwnerSourceFieldId { get; set; }
/// <summary>Gets or sets RuntimeValue.</summary>
public string RuntimeValue { get; set; }
/// <summary>Gets or sets Value.</summary>
public string Value { get; set; }
/// <summary>Gets or sets a value indicating whether CheckNulls.</summary>
public bool CheckNulls { get; set; }
/// <summary>Gets or sets SourceSysName.</summary>
public string SourceSysName { get; set; }
/// <summary>Gets or sets SourceLinkedEntitySysName.</summary>
public string SourceLinkedEntitySysName { get; set; }
/// <summary>Gets or sets ExtendedSource.</summary>
public string ExtendedSource { get; set; }
/// <summary>Gets or sets FilteredSysName.</summary>
public string FilteredSysName { get; set; }
/// <summary>Gets or sets ExtendedFiltered.</summary>
public string ExtendedFiltered { get; set; }
/// <summary>Gets or sets Condition.</summary>
public Guid Condition { get; set; }
/// <summary>Gets or sets OwnerSourceSysName.</summary>
public string OwnerSourceSysName { get; set; }
/// <summary>Gets or sets OwnerSourceFieldLinkedEntitySysName.</summary>
public string OwnerSourceFieldLinkedEntitySysName { get; set; }
}
Original comment by v.tambov...@gmail.com
on 13 Oct 2010 at 11:21
Attachments:
It fails to convert this line: FilteredSysName = a.Filtered != null ?
a.Filtered.SysName : null,
Original comment by v.tambov...@gmail.com
on 13 Oct 2010 at 11:24
Вот тест. Повторяется только в таком виде...
Original comment by v.tambov...@gmail.com
on 14 Oct 2010 at 9:57
Attachments:
Спасибо, сейчас поковыряем :)
Original comment by alexey.g...@gtempaccount.com
on 14 Oct 2010 at 10:04
Исправили, спасибо за хороший пример.
Original comment by alexey.g...@gtempaccount.com
on 14 Oct 2010 at 3:50
Не за что) там два теста, их оба поправили?
Original comment by v.tambov...@gmail.com
on 14 Oct 2010 at 4:36
Original issue reported on code.google.com by
alexey.g...@gtempaccount.com
on 8 Oct 2010 at 8:17