| Home | .NET Object Database | Schindler Call Center | Youth Hostel | Contact | Sitemap | |
| Download | Source Code Example | Database Schema | Tipps and Tricks | LINQ to SQL | |
|
Home > .NET Object Database > Tipps and Tricks Tipps And TricksSQL View UpdateIf you update one column on the view that's no problem. However if you update multiple columns on a view you'll get the error: "View or function is not updatable because the modification affects multiple base tables." This is a limitation of Microsoft SQL Server. However you simple can rephrase the statement as follows:
/* Throws exception: */
/* Works fine: */
Strongly Typed Property NamesIf you don't want to write the name of every property in every get and set method you can use the following code instead. (Reduces slightly performance). With StackFrame you can query the name of the current method automatically:
using
System;
using
System.Diagnostics;
using
Signumsoft.ObjectDatabase;
namespace
HelloWorld
{
public
class Person
: ObjectX
{
...
public string NameFirst
{
get
{
string fieldName =
new
StackFrame().GetMethod().Name.Replace("get_",
null);
return GetValue<string>(fieldName,
null);
}
set
{
string fieldName =
new
StackFrame().GetMethod().Name.Replace("set_",
null);
SetValue(fieldName, value);
}
}
} } SQL Select DistinctObject Instances might appear multiple times in generated SQL views. Resolve it like this: Select Data from View with the following statemant:
SELECT DISTINCT * FROM View_Person
|
|
| © 2008 by Signumsoft® - All rights reserved. | |