Added tag tag1 for changeset 4c285537b335

This commit is contained in:
2011-03-24 10:15:27 +02:00
commit 3c434a0d06
295 changed files with 71368 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="MyFriendsModelContainer" connectionString="metadata=res://*/MyFriendsModel.csdl|res://*/MyFriendsModel.ssdl|res://*/MyFriendsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQL2008;initial catalog=MyFriends;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
@@ -0,0 +1,178 @@
<#
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the Microsoft Public License.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#>
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
CodeGenerationTools code = new CodeGenerationTools(this);
MetadataTools ef = new MetadataTools(this);
MetadataLoader loader = new MetadataLoader(this);
CodeRegion region = new CodeRegion(this);
string inputFile = @"MyFriendsModel.edmx";
EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);
string namespaceName = code.VsNamespaceSuggestion();
EntityContainer container = ItemCollection.GetItems<EntityContainer>().FirstOrDefault();
if (container == null)
{
return "// No EntityContainer exists in the model, so no code was generated";
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Data.Objects;
using System.Data.EntityClient;
using MyFriendsAround.Common.Entities;
<#
if (!String.IsNullOrEmpty(namespaceName))
{
#>
namespace <#=code.EscapeNamespace(namespaceName)#>
{
<#
PushIndent(CodeRegion.GetIndent(1));
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : ObjectContext
{
public const string ConnectionString = "name=<#=container.Name#>";
public const string ContainerName = "<#=container.Name#>";
#region Constructors
public <#=code.Escape(container)#>()
: base(ConnectionString, ContainerName)
{
<#
WriteLazyLoadingEnabled(container);
#>
}
public <#=code.Escape(container)#>(string connectionString)
: base(connectionString, ContainerName)
{
<#
WriteLazyLoadingEnabled(container);
#>
}
public <#=code.Escape(container)#>(EntityConnection connection)
: base(connection, ContainerName)
{
<#
WriteLazyLoadingEnabled(container);
#>
}
#endregion
<#
region.Begin("ObjectSet Properties", 2);
foreach (EntitySet entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=Accessibility.ForReadOnlyProperty(entitySet)#> ObjectSet<<#=code.Escape(entitySet.ElementType)#>> <#=code.Escape(entitySet)#>
{
get { return <#=code.FieldName(entitySet) #> ?? (<#=code.FieldName(entitySet)#> = CreateObjectSet<<#=code.Escape(entitySet.ElementType)#>>("<#=entitySet.Name#>")); }
}
private ObjectSet<<#=code.Escape(entitySet.ElementType)#>> <#=code.FieldName(entitySet)#>;
<#
}
region.End();
region.Begin("Function Imports");
foreach (EdmFunction edmFunction in container.FunctionImports)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, code, ef);
string paramList = String.Join(", ", parameters.Select(p => p.FunctionParameterType + " " + p.FunctionParameterName).ToArray());
if (edmFunction.ReturnParameter == null)
{
continue;
}
string returnTypeElement = code.Escape(ef.GetElementType(edmFunction.ReturnParameter.TypeUsage));
#>
<#=Accessibility.ForMethod(edmFunction)#> ObjectResult<<#=returnTypeElement#>> <#=code.Escape(edmFunction)#>(<#=paramList#>)
{
<#
foreach (var parameter in parameters)
{
if (!parameter.NeedsLocalVariable)
{
continue;
}
#>
ObjectParameter <#=parameter.LocalVariableName#>;
if (<#=parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null"#>)
{
<#=parameter.LocalVariableName#> = new ObjectParameter("<#=parameter.EsqlParameterName#>", <#=parameter.FunctionParameterName#>);
}
else
{
<#=parameter.LocalVariableName#> = new ObjectParameter("<#=parameter.EsqlParameterName#>", typeof(<#=parameter.RawClrTypeName#>));
}
<#
}
#>
return base.ExecuteFunction<<#=returnTypeElement#>>("<#=edmFunction.Name#>"<#=code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()))#>);
}
<#
}
region.End();
#>
}
<#
if (!String.IsNullOrEmpty(namespaceName))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteLazyLoadingEnabled(EntityContainer container)
{
string lazyLoadingAttributeValue = null;
string lazyLoadingAttributeName = MetadataConstants.EDM_ANNOTATION_09_02 + ":LazyLoadingEnabled";
if(MetadataTools.TryGetStringMetadataPropertySetting(container, lazyLoadingAttributeName, out lazyLoadingAttributeValue))
{
bool isLazyLoading = false;
if(bool.TryParse(lazyLoadingAttributeValue, out isLazyLoading))
{
#>
this.ContextOptions.LazyLoadingEnabled = <#=isLazyLoading.ToString().ToLowerInvariant()#>;
<#+
}
}
}
#>
@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Data.Objects;
using System.Data.EntityClient;
using MyFriendsAround.Common.Entities;
namespace MyFriendsAround.Data
{
public partial class MyFriendsModelContainer : ObjectContext
{
public const string ConnectionString = "name=MyFriendsModelContainer";
public const string ContainerName = "MyFriendsModelContainer";
#region Constructors
public MyFriendsModelContainer()
: base(ConnectionString, ContainerName)
{
this.ContextOptions.LazyLoadingEnabled = true;
}
public MyFriendsModelContainer(string connectionString)
: base(connectionString, ContainerName)
{
this.ContextOptions.LazyLoadingEnabled = true;
}
public MyFriendsModelContainer(EntityConnection connection)
: base(connection, ContainerName)
{
this.ContextOptions.LazyLoadingEnabled = true;
}
#endregion
#region ObjectSet Properties
public ObjectSet<Friend> Friends
{
get { return _friends ?? (_friends = CreateObjectSet<Friend>("Friends")); }
}
private ObjectSet<Friend> _friends;
#endregion
}
}
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C3D31B22-BFF4-4DF1-A1EC-C8F158DEEB33}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyFriendsAround.Data</RootNamespace>
<AssemblyName>MyFriendsAround.Data</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Tests|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Tests\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\MyFriendsAround.Data.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyFriends.Context1.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyFriends.Context.tt</DependentUpon>
</Compile>
<Compile Include="MyFriendsModel.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyFriendsModel.edmx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EntityDeploy Include="MyFriendsModel.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>MyFriendsModel.Designer.cs</LastGenOutput>
</EntityDeploy>
</ItemGroup>
<ItemGroup>
<None Include="App.Config" />
<None Include="MyFriends.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MyFriends.Context1.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="MyFriendsModel.edmx.sql" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyFriendsAround.Common\MyFriendsAround.Common.csproj">
<Project>{80664694-C63F-4653-B3FC-617AEC468B3C}</Project>
<Name>MyFriendsAround.Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+4
View File
@@ -0,0 +1,4 @@
// Default code generation is disabled for model 'C:\Projects\MyFriendsAround\MyFriendsAround.Data\MyFriendsModel.edmx'.
// To enable default code generation, change the value of the 'Code Generation Strategy' designer
// property to an alternate value. This property is available in the Properties Window when the model is
// open in the designer.
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="MyFriendsModel.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/02/edm/ssdl">
<EntityContainer Name="MyFriendsModelStoreContainer">
<EntitySet Name="Friends" EntityType="MyFriendsModel.Store.Friends" store:Type="Tables" Schema="dbo" />
</EntityContainer>
<!--Errors Found During Generation:
warning 6005: The data type 'geography' is not supported; the column 'Location' in table 'MyFriends.dbo.Friends' was excluded.
-->
<EntityType Name="Friends">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="nvarchar" Nullable="false" MaxLength="100" />
<Property Name="FriendName" Type="nvarchar" Nullable="false" MaxLength="50" />
<Property Name="FriendImageUrl" Type="nvarchar" MaxLength="150" />
<Property Name="LocationStr" Type="nvarchar" MaxLength="100" />
<Property Name="LastUpdated" Type="datetime" Nullable="false" />
</EntityType>
<Function Name="UpdateFriendLocationById" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="FriendID" Type="nvarchar" Mode="In" />
</Function>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="MyFriendsModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntityContainer Name="MyFriendsModelContainer" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Friends" EntityType="MyFriendsModel.Friend" />
<FunctionImport Name="UpdateFriendLocationById">
<Parameter Name="FriendID" Mode="In" Type="String" />
</FunctionImport>
</EntityContainer>
<EntityType Name="Friend">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Type="String" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Type="String" Name="FriendName" Nullable="false" />
<Property Type="String" Name="FriendImageUrl" Nullable="false" />
<Property Type="String" Name="LocationStr" Nullable="false" />
<Property Type="DateTime" Name="LastUpdated" Nullable="false" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="MyFriendsModelStoreContainer" CdmEntityContainer="MyFriendsModelContainer">
<EntitySetMapping Name="Friends">
<EntityTypeMapping TypeName="IsTypeOf(MyFriendsModel.Friend)">
<MappingFragment StoreEntitySet="Friends">
<ScalarProperty Name="LastUpdated" ColumnName="LastUpdated" />
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="FriendName" ColumnName="FriendName" />
<ScalarProperty Name="FriendImageUrl" ColumnName="FriendImageUrl" />
<ScalarProperty Name="LocationStr" ColumnName="LocationStr" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<FunctionImportMapping FunctionImportName="UpdateFriendLocationById" FunctionName="MyFriendsModel.Store.UpdateFriendLocationById" />
</EntityContainerMapping>
</Mapping></edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<edmx:Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</edmx:Connection>
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="True" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
</DesignerInfoPropertySet>
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram Name="MyFriendsModel" >
<EntityTypeShape EntityType="MyFriendsModel.Friend" Width="1.5" PointX="3.75" PointY="1" Height="1.787985026041667" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>
@@ -0,0 +1,55 @@
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/14/2011 17:28:59
-- Generated from EDMX file: D:\Projects\MyFriendsAround\MyFriendsAround.Data\MyFriendsModel.edmx
-- --------------------------------------------------
SET QUOTED_IDENTIFIER OFF;
GO
USE [MyFriends];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------
-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------
-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------
-- Creating table 'Friends'
CREATE TABLE [dbo].[Friends] (
[Id] nvarchar(max) NOT NULL,
[FriendName] nvarchar(max) NOT NULL,
[FriendImageUrl] nvarchar(max) NOT NULL,
[LocationStr] nvarchar(max) NOT NULL
);
GO
-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------
-- Creating primary key on [Id] in table 'Friends'
ALTER TABLE [dbo].[Friends]
ADD CONSTRAINT [PK_Friends]
PRIMARY KEY CLUSTERED ([Id] ASC);
GO
-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------
-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyFriendsAround.Data")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("MyFriendsAround.Data")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("283a7fe4-6a6b-4c8c-b9ae-aab365b6b910")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]