AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

Incorrect Linq Data Context #554

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use QuickStart w. Linq support on some SQL database (anything except petshop)
2. Enter data context name and namespace options for the Linq properties section
3. Generate new project
4. Generate code for Entities using Entities.cst.

Expected output is the specified data context name & namespace are being used 
in the generated entity classes.
What I see instead are references to PetshopDataContext.

What version of the product are you using?
Nightly template CSLA-r2130.

Please provide any additional information below.
Example:
a. Top of the Object.DataAccess.cs class specifies:
using L2SDataContext;
using DAL=L2SDataContext;

b. This causes the compiler to flag L2SDataContext as unknown, possibly missing 
a reference.

c. The method is generated like this:
        protected override void DataPortal_Insert()
        {
            //LinqToSQL Modification
            bool cancel = false;
            OnInserting(ref cancel);
            if (cancel) return;

            // Get State data for a single criteria
            using (var ctx = ContextManager<DAL.PetshopDataContext>.GetManager(LinqToSQLHelper.ConnectionString, true))
            {
                DAL.State item = new DAL.State();

                using (BypassPropertyChecks)
                {
                    item.Code = this.Code;
                    item.Descr = this.Descr;
                }

                ctx.DataContext.State.InsertOnSubmit(item);
                ctx.DataContext.SubmitChanges();
                LoadProperty(_identificationProperty, item.id);
                FieldManager.UpdateChildren(this);
                OnInserted();
            }
        }

Original issue reported on code.google.com by andrei.d...@gmail.com on 11 Feb 2011 at 10:13

GoogleCodeExporter commented 9 years ago
Hello,

Thank you for reporting this bug. We'll take a look into this and get it fixed 
in this version.

Please note that the current support for Linq-to-SQL should be considered as 
alpha but it is something that we will be supporting.  If you are using a 
production application and don't have a requirement on Linq-to-SQL than we 
recommend using Parameterized SQL or Stored Procedures as the 
DataAccessImplementation for now. The LinqToSQL DataAccessImplementation was 
contributed by a end user and has not been tested. We will be fully developing 
the LINQ to SQL integration in the next version of the templates. 

Please by all means keep the bug report or feature suggestions coming in!

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 14 Feb 2011 at 7:25

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 12 Mar 2012 at 4:15