Столкнувшись с той же проблемой, я обнаружил, что самым быстрым решением было на самом деле отсканировать строки ячеек, которые я хотел отсортировать, определить последнюю строку с непустым элементом, а затем выбрать и отсортировать эту группу.
Dim lastrow As Integer
lastrow = 0
For r = 3 To 120
If Cells(r, 2) = "" Then
Dim rng As Range
Set rng = Range(Cells(3, 2), Cells(r - 1, 2 + 6))
rng.Select
rng.Sort Key1:=Range("h3"), order1:=xlDescending, Header:=xlGuess, DataOption1:=xlSortNormal
r = 205
End If
Next r
Вам следует ознакомиться с моей серией советов EF .
Тот, который называется Как выбрать стратегию наследования , должен дать вам больше информации
Надеюсь, это поможет
Alex
When considering how to represent inheritance in the database, you need to consider a few things.
If you have many different sub classes you can have a lot of extra joins in queries involving those more complex types which can hurt performance. One big advantage of TPH is that you query one table for all types in the hierarchy and this is a boon for performance, particularly for larger hierarchies. For this reason i tend to favour that approach in most scenarioes
However, TPH means that you can no longer have NOT NULL
fields for sub types as all fields for all types are in a single table, pushing the responsibility for data integrity towards your application. Although this may sound horrible in practice i haven't found this to be too big a restriction.
However i would tend to use TPT if there were a lot of fields for each type and that the number of types in the hierarchy was likely to be small, meaning that performance was not so much of an issue with the joins, and you get better data integrity.
Note that one of the advantages of EF and other ORMs is that you can change your mind down the track without impacting your application so the decision doesn't need to be completely carved in stone.
In your example, it doesn't appear to have an inheritance relationship, it looks like a one to many from the address type to the addresses
This would be represented between your classes something like the following:
Address.AddressType
AddressType.Addresses
Как намекает Кейт, эта статья предполагает, что TPT в EF ужасно масштабируется, но я сам не пробовал.