I have done some testing with the Scope attribute while running an SQL Profiler.
My table has a primary key of 'ProductCode'. If I do not include a scope option, when I execute my getProduct()/getItem() method I see the following SQL:
SELECT NULL FROM [Product]
I added the following line to my Product.cs file:
[Scope("productCode")]
After adding this line the SQL Profiler showed that this query was being attempted:
exec sp_executesql N'SELECT NULL FROM [Product] WHERE [productCode]=@0',N'@0 nvarchar(4000)',@0=N'ANDY'
I tested by modifying the string I put in the Scope attribute to "PortalId" and "Nothing". Both cases resulted in the same query as "productCode". If anyone knows why this is happening, please let me know.
I am not certain but it does not appear Scope is connected to the "SELECT NULL" problem because it is happening with or without the Scope attribute.
Does anyone have any ideas about how I can get my object connected to the database with DAL2 or why I am seeing "SELECT NULL" instead of the fields?