sql server - Is there a practical way to use the hierarchyID datatype in entity framework 4? -
As it stands now, CRR with serial unit UDT is not supported in Entry Framework 4. HierarchyID.ToString () is useful, but 10+ siblings of any object (basic structure / 3/4/12 / or / 3/4/2 / , Then break after 12th node will be sorted before 2 nodes)
-
Revert the hierarchy as a varnallini and apply your own hierarchy .ostrank () method that pad numbers with zero during the creation of the string So that the resulting string is sorted Defense could be (ie "/ 0003/0004 / 0012 /"). I disassebled Microsoft.SqlServer.Types.dll and saw the implementation. It seems that the interval is based on a class named "OrdTree" and I use that class again as the basis of the implementation Can i
-
Write your own CLR type for SQL, work on binary data and make your string (a variation of option 2). However, an additional deployment comes with headache.
-
Write a SQL udf to parse the hierarchy string and pad on the DB layer. The lack of array processing / reggae seems like the biggest problem here.
-
Sort the hierarchy on the database layer and use the ROW_NUMBER () function as the stand for sort order.
-
Write some helpful methods on the .NET layer, which is the hierarchy ID. Toresister () parses again and generates a sequential string (i.e. "/ 0003/0004/0012 /" ).
So has my question worked around any border? Have you used the above strategies? if so, how?
OK, I think the views are getting but no answer. I had some urgent need to work with the hierarchy structure above SQL, so I put together a steady assistant class. I do not consider this to be a complete solution, but so far it works relatively well. Footpath
is really important function here.
public stable class SQLHierarchyManipulatin {const int DEFAULT_PAD_LEN = 3; Const char DEFAULT_PAD_CHAR = '0'; Public stable string padpath (string hierarchy) {return padpath (hierarchy, DEFAULT_PAD_LEN); } Public stable string padpath (string hierarchy, int paddle) {string [] components = hierarchy. Sample ('/'); For (var i = 0; i
Hope this helps anyone! However, I still want to hear from people
Comments
Post a Comment