C# Ado.Net实体生成“;找不到命名空间";
我已经看到了几种可能的解决方案,但没有一种对我有效 将ADO.NET实体数据模型添加到.NET Forms C#web项目后,我无法使用它 也许我加错了?添加的文件名为QcFormData.edmx 我没有正确地实例化它?我尝试添加一行:C# Ado.Net实体生成“;找不到命名空间";,c#,.net,entity-framework,C#,.net,Entity Framework,我已经看到了几种可能的解决方案,但没有一种对我有效 将ADO.NET实体数据模型添加到.NET Forms C#web项目后,我无法使用它 也许我加错了?添加的文件名为QcFormData.edmx 我没有正确地实例化它?我尝试添加一行: QcFormData db = new QcFormData(); Error 13 The type or namespace name 'QcFormData' could not be found (are you missing a usin
QcFormData db = new QcFormData();
Error 13 The type or namespace name 'QcFormData' could not be found (are you missing a using directive or an assembly reference?)
我遵循了我在网上发现的没有帮助的建议:
1) 确保存在“正在使用System.Data.Entity”
2) 确保dll存在
3) 确保引用存在
4) 一篇帖子说使用系统。Web.Data.Entity;但我看不到这一点
我错过了什么
QcFormData.edmx
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="MyCoModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityContainer Name="MyCoModelStoreContainer">
<EntitySet Name="QcFieldValues" EntityType="MyCoModel.Store.QcFieldValues" store:Type="Tables" Schema="dbo" />
</EntityContainer>
<EntityType Name="QcFieldValues">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="FieldID" Type="nvarchar" MaxLength="100" />
<Property Name="FieldValue" Type="nvarchar" MaxLength="100" />
<Property Name="DateTimeAdded" Type="datetime" />
<Property Name="OrderReserveNumber" Type="nvarchar" MaxLength="50" />
</EntityType>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="MyCoModel" Alias="Self" p1:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:p1="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="MyCoEntities" p1:LazyLoadingEnabled="true">
<EntitySet Name="QcFieldValues" EntityType="MyCoModel.QcFieldValue" />
</EntityContainer>
<EntityType Name="QcFieldValue">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" p1:StoreGeneratedPattern="Identity" />
<Property Name="FieldID" Type="String" MaxLength="100" Unicode="true" FixedLength="false" />
<Property Name="FieldValue" Type="String" MaxLength="100" Unicode="true" FixedLength="false" />
<Property Name="DateTimeAdded" Type="DateTime" Precision="3" />
<Property Name="OrderReserveNumber" Type="String" MaxLength="50" Unicode="true" FixedLength="false" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="MyCoModelStoreContainer" CdmEntityContainer="MyCoEntities">
<EntitySetMapping Name="QcFieldValues">
<EntityTypeMapping TypeName="MyCoModel.QcFieldValue">
<MappingFragment StoreEntitySet="QcFieldValues">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="FieldID" ColumnName="FieldID" />
<ScalarProperty Name="FieldValue" ColumnName="FieldValue" />
<ScalarProperty Name="DateTimeAdded" ColumnName="DateTimeAdded" />
<ScalarProperty Name="OrderReserveNumber" ColumnName="OrderReserveNumber" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="True" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>
我将Linq添加到SQL类项中,而不是ADO.Net实体数据模型项,现在它工作正常,无需在代码顶部添加名称空间。如果有人对具体解决方案有任何建议,那么这将是非常好的。我很高兴张贴任何具体的文件要求
正如我前面提到的,如果这是一个名称空间问题,我仍然不知道如何解决它。人们建议我做了一些失败的事情,但不确切地说是什么,要添加的名称空间,在哪里找到它,等等。QcFormDataContainer是如何定义的?不,它位于项目的根目录中,以及我调用它的aspx文件和aspx.cs文件。现在,在清理和重新编译之后,QcFormDataContainer不再显示在Intellisense中。但我仍然无法访问QcFormData对象。是否可以发布QcFormDataContainer的代码?您甚至不需要发布所需的代码。并且希望得到结果!这只是复制和粘贴一些代码!!!