This should be used with test application sent to you earlier. So, the code:

var m = new Module(Guid.NewGuid()) { Name = "qwe", SysName = "qwe" };
var e = new DocEntity(Guid.NewGuid()) { Name = "qwe", SysName = "qwe", Module = m };
var item = new DocumentOperation(Guid.NewGuid()) { Entity = e, Name = "qwe" };
var complexFields = new List<Guid>(EnFieldType.ListTypes) { FieldType.Link.GetId() };
var fields = item.Entity.Fields
.Where(f => f.IsNullable == false || (!f.EnFieldType.Id.In(complexFields) && !f.IsNullable.HasValue));

var operFields = item.OperationFields.Select(t => t.Field);

var res = fields.Except(operFields);
res.Any()

This produces this:

Xtensive.Orm.SyntaxErrorException : Error 'SyntaxError' while executing query 'SELECT CAST((CASE WHEN EXISTS (SELECT * FROM ((SELECT [a].[Id], [a].[TypeId], [a].[Description], [a].[EnFieldType_Id], [a].[Entity_Id], [a].[ImplementsInterface_Id], [a].[InheritedFromClass_Id], [a].[IsNullable], [a].[IsVirtual], [a].[Length], [a].[LinkedByEntityField_Id], [a].[LinkedEntity_Id], [a].[Name], [a].[OnRemoveActionType_Id], [a].[OwnerModule_Id], [a].[Precision], [a].[Revision], [a].[Scale], [a].[SysName], [a].[Status_Id], [a].[Creator_Id] FROM (SELECT [b].[Id], 126 AS [TypeId], [b].[Description], [b].[EnFieldType_Id], [b].[Entity_Id], [b].[ImplementsInterface_Id], [b].[InheritedFromClass_Id], [b].[IsNullable], [b].[IsVirtual], [b].[Length], [b].[LinkedByEntityField_Id], [b].[LinkedEntity_Id], [b].[Name], [b].[OnRemoveActionType_Id], [b].[OwnerModule_Id], [b].[Precision], [b].[Revision], [b].[Scale], [b].[SysName], [b].[Status_Id], [b].[Creator_Id] FROM [dbo].[DocEntityField] [b] WHERE ([b].[Entity_Id] = @p0_0)) [a] WHERE (([a].[IsNullable] = 0) OR ((NOT [a].[EnFieldType_Id] IN (@p0_1_0_0, @p0_1_1_0, @p0_1_2_0, @p0_1_3_0)) AND (NOT (([a].[IsNullable] <> 0) IS NOT NULL))))) EXCEPT (SELECT [c].[#b.Id], [c].[#b.TypeId], [c].[#b.Description], [c].[#b.EnFieldType_Id], [c].[#b.Entity_Id], [c].[#b.ImplementsInterface_Id], [c].[#b.InheritedFromClass_Id], [c].[#b.IsNullable], [c].[#b.IsVirtual], [c].[#b.Length], [c].[#b.LinkedByEntityField_Id], [c].[#b.LinkedEntity_Id], [c].[#b.Name], [c].[#b.OnRemoveActionType_Id], [c].[#b.OwnerModule_Id], [c].[#b.Precision], [c].[#b.Revision], [c].[#b.Scale], [c].[#b.SysName], [c].[#b.Status_Id], [c].[#b.Creator_Id] FROM (SELECT [d].[Id], 129 AS [TypeId], [d].[Field_Id], [d].[IsEnabled], [d].[NotNullable], [d].[Visible], [d].[Owner_Id] FROM [dbo].[DocumentOperation_TpOperationField] [d] WHERE ([d].[Owner_Id] = @p0_2)) [e] INNER JOIN (SELECT [f].[Id] AS [#b.Id], 126 AS [#b.TypeId], [f].[Description] AS [#b.Description], [f].[EnFieldType_Id] AS [#b.EnFieldType_Id], [f].[Entity_Id] AS [#b.Entity_Id], [f].[ImplementsInterface_Id] AS [#b.ImplementsInterface_Id], [f].[InheritedFromClass_Id] AS [#b.InheritedFromClass_Id], [f].[IsNullable] AS [#b.IsNullable], [f].[IsVirtual] AS [#b.IsVirtual], [f].[Length] AS [#b.Length], [f].[LinkedByEntityField_Id] AS [#b.LinkedByEntityField_Id], [f].[LinkedEntity_Id] AS [#b.LinkedEntity_Id], [f].[Name] AS [#b.Name], [f].[OnRemoveActionType_Id] AS [#b.OnRemoveActionType_Id], [f].[OwnerModule_Id] AS [#b.OwnerModule_Id], [f].[Precision] AS [#b.Precision], [f].[Revision] AS [#b.Revision], [f].[Scale] AS [#b.Scale], [f].[SysName] AS [#b.SysName], [f].[Status_Id] AS [#b.Status_Id], [f].[Creator_Id] AS [#b.Creator_Id] FROM [dbo].[DocEntityField] [f]) [c] ON ([e].[Field_Id] = [c].[#b.Id]))) [g]) THEN 1 ELSE 0 END)  AS bit) AS [c01umn1]; [p0_0='80ebdde3-7faa-4b90-0000-000000000000';p0_1_0_0='378115d3-bd5e-44d7-a39a-417667e5d1bf';p0_1_1_0='0bdd51d6-e834-48b8-840e-9f17b4339d59';p0_1_2_0='76fb87c9-a9c7-4e8f-bc14-a0d30e1b3a9d';p0_1_3_0='5f2531f6-3581-450f-b5b0-d3e46de660e2';p0_2='9cc6f3c2-e03b-4b6e-8dd2-21b17a106d15']'. Original message: Incorrect syntax near the keyword 'IS'.
Incorrect syntax near ')'.

asked Aug 31 '11 at 02:49

xumix's gravatar image

xumix
425717682

edited Aug 31 '11 at 02:57

Thanks, will check this.

(Sep 01 '11 at 05:42) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

Fixed in 7767 (a47aa2476a14)

answered Sep 23 '11 at 08:08

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

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

powered by OSQA