Sculpture Community  Sculpture Discu...  Sculpture 2.1  CRUD with Entity Framework
Previous Previous
 
Next Next
New Post 2/26/2010 1:45 PM
  Calvin
9 posts


CRUD with Entity Framework 

Hi, 

following the video "build your CRUD in 6 minutes" I tried to change the data access mold from nhibernate to entity framework. The application run correctly like with nhibernate but when I try to modify a task record previously entered ) changing the project fields ( in the combobox ) and save, this record is not updated. Viceversa if I modifiy for example the task description the record is updated.

Thanks! 

Flavio

 
New Post 3/18/2010 8:21 PM
  Calvin
9 posts


Re: CRUD with Entity Framework 

Hi,

the post above is written with reference to the video for simplicity but I have the same problem with a real project. Please can you answer me ?

Thanks, Flavio.
 

 
New Post 3/21/2010 1:09 PM
  TAboraya
258 posts


Re: CRUD with Entity Framework 

Dear Flavio,

Of course before we published the Entity Framework Mold we simulate the video and get the same results as NHibernate,

But according to your problem we will re simulate the video again and send you the result very soon.

Best Regards,


Tamer Aboraya - Product Manager - Sculpture project
 
New Post 3/23/2010 10:19 PM
  TAboraya
258 posts


Re: CRUD with Entity Framework 

Dear Flavio,

I run the sample and get the same issue.

You can fix it in the "[InstalledDirs]\Molds\NHibernateMold\EntityRepository.tt"

By replace from line 82 to 87 with the following:

            var original<#= Entity.Name #> = Get<#= Entity.Name #>(<#= GetRepositoryPrimaryKeysWithoutTypes(Entity,Entity.Name) #>);
<#
                foreach (Association association in SculptureModel.Store.ElementDirectory.FindElements<Association>())
                {
                    if(Entity == association.TargetEntity)
                    {
                        if(association.EndOneMultiplicity == Dawliasoft.Sculpture.Multiplicity.One)
                        {
#>
            original<#= Entity.Name #>.<#= association.EndTwoRole #> = <#= ToCamel(Entity.Name) #>.<#= association.EndTwoRole #>;
<#
                        }
                    }
                    if(Entity == association.SourceEntity)
                    {
                        if(association.EndTwoMultiplicity == Dawliasoft.Sculpture.Multiplicity.One)
                        {
#>
            original<#= Entity.Name #>.<#= association.EndOneRole #> = <#= ToCamel(Entity.Name) #>.<#= association.EndOneRole #>;
<#
                        }
                    }
                }
#>
            if(<#= ToCamel(Entity.Name) #>.EntityState == System.Data.EntityState.Added)
            {
                _objectContext.Detach(<#= ToCamel(Entity.Name) #>);
                attachingFlag = true;
            }


Tamer Aboraya - Product Manager - Sculpture project
 
New Post 3/26/2010 5:35 PM
  Calvin
9 posts


Re: CRUD with Entity Framework 

Thanks a lot !!!

I have replace your code in :

"[InstalledDirs]\Molds\EntityFrameworkMold\Templates\EntityRepository.tt"
and not in
"[InstalledDirs]\Molds\NHibernateMold\EntityRepository.tt"

 
Previous Previous
 
Next Next
  Sculpture Community  Sculpture Discu...  Sculpture 2.1  CRUD with Entity Framework
Users Minimize
 
Membership Membership:
Latest New User Latest: Fosna
New Today New Today: 3
New Yesterday New Yesterday: 7
User Count Overall: 2772

People Online People Online:
Visitors Visitors: 0
Members Members: 0
Total Total: 0

Online Now Online Now: