Forum Account
Forum Account

Reputation: 53

error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer

I just have...

public TEntity GetSingle(ISpecification<TEntity> Specification)
    {
        //return this._Context.CreateDbSet<TEntity>()
        //    .SingleOrDefault<TEntity>(Specification.SatisfiedBy());
        if (Specification == null)
        {
            throw new ArgumentNullException("Specification");
        }
        IEnumerable<TEntity> source = this._Context.CreateDbSet<TEntity>().Where(Specification.SatisfiedBy()).AsEnumerable<TEntity>();
        if (source.Count<TEntity>() > 0)
        {
            return source.First<TEntity>();
        }
        return default(TEntity);
    }

... which gives me an error when trying to execute this._Context.CreateDbSet()

The error is marked green and the message is something like:

Exception of type 'System.Data.Entity.Core.MappingException' at mscorlib.dll but it was not caught by user code.
Additional Information: Schema specified is not valid. Errors: 
Models.Company.CompanyModel.msl(3,4) : error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer iOfferEntities.

I have the following connection strings at Web.config and App.config like...

<add name="iOfferEntities" connectionString="metadata=res://*/Models.Company.CompanyModel.csdl|res://*/Models.Company.CompanyModel.ssdl|res://*/Models.Company.CompanyModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.1.31;initial catalog=mto3;persist security info=True;user id=myuserid;password=mypassword;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

I have a connection to another database in the same server which I can work with no problems.

Any idea?

Thank you!!!

Upvotes: 2

Views: 7541

Answers (1)

Forum Account
Forum Account

Reputation: 53

Well, I created a new model and got rid of the problematic one. Problem solved so far. Thanks anyway to all.

Upvotes: 1

Related Questions