VB имеет следующий If
оператор, к которому относится вопрос, я думаю:
' Usage 1
Dim result = If(a > 5, "World", "Hello")
' Usage 2
Dim foo = If(result, "Alternative")
первым является в основном троичный условный оператор C#, и второе является объединять оператор (возврат result
, если it’s Nothing
, в этом случае не возвратитесь "Alternative"
). If
таким образом заменил IIf
, и последний является устаревшим.
Как в C#, условное выражение VB If
короткие замыкания оператора, таким образом, можно теперь безопасно записать следующее, которое не является возможным использованием эти IIf
функция:
Dim len = If(text Is Nothing, 0, text.Length)
The tablename_column name convention is used to ensure that all fields within a database are unique, although it is somewhat excessive it can be used for when there is a standard / requirement for unique naming (Which some client IT departments demand.)
Product.Name => Product.Product_Name
Part.Name => Part.Part_Name
It removes any ambiguity over where Name would come from.
I prefer not to name tables with a prefex at all (assuming that does not break the local standards of a company), since whilst it might be a table today, it could be re-implemented as a view or partitioned view tomorrow but expose the same schema, and I would then have to accept objects prefixed incorrectly or update everyones reference to the new name / create a synonym.
Having consistency though tends to be the winner, if every DBA / Dev implemented their own version it would be chaos, so I would tend to find the company standards and apply them.
В хранилищах данных принято называть столбцы «длинными именами», потому что эти столбцы становятся заголовками столбцов в отчетах (результатах запроса) и должны быть удобными для бизнес-пользователей. Поэтому вместо Product.Name
и Customer.Name
, которые будут отображаться как «Имя» (если не используется псевдоним), обычно используется Product.ProductName
и Customer.CustomerName
, поэтому они отображаются как "ProductName" и "
Имена таблиц :
Имена столбцов:
Хранилище и присвоение имен OLTP: