Getting some strange exception. If i remove the Index attribute everything is working fine.

I guess it is because of null in keyFields but if i'm passing "" (empty string) i'm getting "Column Name can't be empty" exception

Code:
    [Serializable]
    [HierarchyRoot]
    [Index("Code",null,Unique=true)]
    public class FilterDefinition : BaseEntity<int>
    {
        [Field(Nullable=false)]
        public string Code { get; set; }

... code from wcf sample (ClientDomain class)

Instance = Domain.Build(domainConfiguration);

...

Call stack:

   at Xtensive.Orm.IndexAttribute..ctor(String keyField, String[] keyFields) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Attributes\IndexAttribute.cs:line 82
   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
   at Xtensive.Reflection.AttributeHelper.GetAttributes[TAttribute](MemberInfo member) in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Reflection\AttributeHelper.cs:line 50
   at Xtensive.Reflection.AttributeHelper.GetAttributes[TAttribute](MemberInfo member, AttributeSearchOptions options) in c:\Temp\DataObjects.Net\Xtensive.Core\Xtensive.Core\Reflection\AttributeHelper.cs:line 64
   at Xtensive.Orm.Building.Builders.ModelDefBuilder.ProcessIndexes(TypeDef typeDef) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\ModelDefBuilder.cs:line 174
   at Xtensive.Orm.Building.Builders.ModelDefBuilder.ProcessType(Type type) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\ModelDefBuilder.cs:line 94
   at Xtensive.Orm.Building.Builders.ModelDefBuilder.ProcessTypes() in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\ModelDefBuilder.cs:line 54
   at Xtensive.Orm.Building.Builders.ModelDefBuilder.Run() in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\ModelDefBuilder.cs:line 32
   at Xtensive.Orm.Building.Builders.ModelBuilder.Run() in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\ModelBuilder.cs:line 37
   at Xtensive.Orm.Building.Builders.DomainBuilder.BuildModel() in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\DomainBuilder.cs:line 213
   at Xtensive.Orm.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Building\Builders\DomainBuilder.cs:line 63
   at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Upgrade\UpgradingDomainBuilder.cs:line 82
   at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Upgrade\UpgradingDomainBuilder.cs:line 62
   at Xtensive.Orm.Domain.Build(DomainConfiguration configuration) in c:\Temp\DataObjects.Net\Xtensive.Orm\Xtensive.Orm\Orm\Domain.cs:line 281

asked Feb 04 '11 at 01:59

Janosh's gravatar image

Janosh
47101015

edited Feb 04 '11 at 02:05

With new string[]{} it is working.

(Feb 04 '11 at 02:06) Janosh Janosh's gravatar image

One Answer:

Hello Janosh,

Try removing the second argument (null) as it is useless.

[Index("Code", Unique=true)] // Should work

answered Feb 04 '11 at 02:32

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573
×16

Asked: Feb 04 '11 at 01:59

Seen: 3,270 times

Last updated: Feb 04 '11 at 02:32

powered by OSQA