コード例 #1
0
        public static EF6Model Create(SqlConnection connection, string siteName)
        {
            EF6Model ctx = new EF6Model(connection, false);

            ctx.SiteName         = siteName;
            ctx.ConnectionString = connection.ConnectionString;
            return(ctx);
        }
コード例 #2
0
        public static EF6Model Create(IMappingConfigurator configurator, SqlConnection connection, bool contextOwnsConnection)
        {
            var mapping = configurator.GetMappingInfo(connection);
            var ctx     = new EF6Model(connection, mapping.DbCompiledModel, mapping.Schema, contextOwnsConnection);

            ctx.SiteName         = mapping.Schema.Schema.SiteName;
            ctx.ConnectionString = connection.ConnectionString;
            return(ctx);
        }
コード例 #3
0
        public static EF6Model Create(string connection, string siteName)
        {
            EF6Model ctx;

            if (connection.IndexOf("metadata", StringComparison.InvariantCultureIgnoreCase) == -1)
            {
                ctx                  = new EF6Model(new SqlConnection(connection), true);
                ctx.SiteName         = siteName;
                ctx.ConnectionString = connection;
                return(ctx);
            }

            ctx                  = new EF6Model(connection);
            ctx.SiteName         = siteName;
            ctx.ConnectionString = connection;
            return(ctx);
        }