PDA

View Full Version : خطا هنگام کار با دیتابیس تکنولوژی EF



hamid_hr
پنج شنبه 14 فروردین 1393, 13:42 عصر
سلام
من میخوام EF رو شروع کنم یاد بگیرم
یه آموزش پیدا کردم کار میکنم
اولین خطایی که برخوردم اینه

System.Data.MetadataException was unhandled HResult=-2146232007
Message=Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type '...'. Previously found CLR type '...'newly found CLR type '...'
Source=System.Data.Entity
StackTrace:
at System.Data.Metadata.Edm.ObjectItemCollection.Load AssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.Expl icitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.MetadataWorkspace.Explici tLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action`1 logLoadMessage)
at System.Data.Entity.Internal.InternalContext.TryUpd ateEntitySetMappingsForType(Type entityType)
at System.Data.Entity.Internal.InternalContext.Update EntitySetMappingsForType(Type entityType)
at System.Data.Entity.Internal.InternalContext.GetEnt itySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Ini tialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get _InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1.System .Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector)
at Arya.AllFunction.Buy.SelectCount() in ...:line 22728
at Arya.FrmBuy.OrderRegister.butsave_Click(Object sender, EventArgs e) in ... :line 300
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at Arya.Program.LoadInfo() in ...:line 67
at Arya.Program.Main(String[] args) in ...:line 47
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:




اینم دستوری که نوشتم
var tmp = new EntityFramework.PSAryaEntities1(); var q = (from x in tmp.Factor_Buy_Order
select x.IDPK).Count();

parvizwpf
پنج شنبه 14 فروردین 1393, 15:48 عصر
احتمال اینکه درست نتونسته سیستم شآیجکتینگ خودشو بسازه و پیاده کنه. کدتون رو کلا میشه بزارید. db first ساختید یا codefirst?

hamid_hr
پنج شنبه 14 فروردین 1393, 15:58 عصر
db first ساختید یا codefirst?
ببخشید این یعنی چی؟:گیج:

parvizwpf
پنج شنبه 14 فروردین 1393, 16:13 عصر
چطور ساختار ef رو ایجاد کرده اید؟ رفتید بصورت ویزارد با توجه به یک دیتابیس ساختید یا خودتون کد زدید و همشو هندل کردید؟

parvizwpf
پنج شنبه 14 فروردین 1393, 16:15 عصر
خطا در اصا داره میگه من توی ساختار آیجکتیو ساخته شده شما از دیتابیس تداخل و تکرار میبینم شما دارید چند چیز رو تکراری میدید.

hamid_hr
پنج شنبه 14 فروردین 1393, 16:16 عصر
با ویزارد درستش کردم

parvizwpf
پنج شنبه 14 فروردین 1393, 16:22 عصر
دوباره بسازید و تست کنید من احتمال میدم داره براتون فایلهای tt ایجاد مبکنه. یا برید ببینید کجاها تداخل و تکرار دارید.